« All Events
10 AM – Intro To Java
November 20, 2021 @ 10:00 am - 11:00 am
Homework
- Inside MonsterInheritance project add run() method.
- Inside run() method, call initializeMonster() method and then continuously print the following menu
Please select one of the following monsters:
- Troll - health remaining: 50
- Dragon - health remaining: 100
- Water Golem - health remaining: 30
Enter your selection (Enter 'exit' to quit):
- when the user enter “exit” break from the loop.
- when the user enter one of the monster species name, display the second menu.
- When user select “2. Melle attack”, ask user how much attack point . And then reduce the monster health by calling monster.doDamage(attackPointFromUser).
Please select one of the following monsters:
- troll - 50 Health remaining
- water golem - 30 Health remaining
- dragon - 100 Health remaining
- Exit
Enter your selection: troll
What do you want to do with the troll:
1. Magic attack
2. Melle attack
3. Arrow attack
4. Heal
Enter your selection: 2
How much melle attack you want to do to troll: 10
You attacked the troll and it has 40 healths remaining.
Please select one of the following monsters:
- troll - 40 Health remaining
- water golem - 30 Health remaining
- dragon - 100 Health remaining
- Exit
Enter your selection: