American Young Coder (AYC)

AYC logo
Loading Events

« All Events

  • This event has passed.

5 PM – Intro To Java – Gamas

April 30, 2022 @ 5:00 pm - 6:00 pm

Today We Do
  1. We added Dragon.java class and made it inherits from Monster.java
  2. Using inheritance, we overrode Monster.doDamage(int damage) inside Dragon class.
Homework
  1. Create Troll.java class and made it inherits from Monster.java. Use this Troll class inside MonsterInheritanceMain.initializeMonster() method.
  2. Using inheritance, we overrode Monster.doDamage(int damage) inside Troll class so it will make Troll immune to melee attack. Inside this method, make sure to print “Troll is immune to hand to hand attack. No damage is done.”. This is very similar
  3. Inside MonsterInheritanceMain when user select “1. Magic attack”, display the following menu
  4. What do you want to do with the dragon:
    1. Magic attack
    2. Melee attack
    3. Arrow attack
    4. Heal
    Enter your selection:1
    
    What kind of magic attack you want to do to dragon:
    1. Fire magic - 10 damage
    2. Water magic - 10 damage
    3. Earth magic - 12 damage
    4. Wind magic - 8 damage
    Enter your selection:1
    You attacked dragon with fire magic and did 10 damage to DRAGON.
    DRAGON attacked Gamas and did 10 damage

Details

Date:
April 30, 2022
Time:
5:00 pm - 6:00 pm
Verified by MonsterInsights