- This event has passed.
7 PM – Intro To Java – Darin
August 5 @ 7:00 pm - 8:00 pm
What We Did Today:
- Started on the Monster Inheritance project, implement all functionalities except for the play method().
Homework:
- Create the start of the play() method.
- After printing out the header “ADD PLAYER”, get input from the shell after asking the user what monster they want to fight
- Check the input by using .get(), where .get() returns the monster object if the key exists, and null otherwise.
- Print out “Monster exists” if .get() works to get a valid monster, and “Monster %s does not exist in the system. Please try again.” otherwise
- You will want to name the input for the monster as monsterKey
Sample output:
PLAY GAME
Enter player name: darin
Enter player name: 100
darin has 100 health remaining.
Please select one of the following monsters:
Troll – 75 health – 10 max attack
Goblin – 30 health – 5 max attack
Dragon – 100 health – 20 max attack
Enter your selection (Enter ‘stop’ to end the game): trol
Monster trol does not exist in the system. Please try again.
darin has 100 health remaining.
Please select one of the following monsters:
Troll – 75 health – 10 max attack
Goblin – 30 health – 5 max attack
Dragon – 100 health – 20 max attack
Enter your selection (Enter ‘stop’ to end the game): troll
Monster exists
darin has 100 health remaining.
Please select one of the following monsters:
Troll – 75 health – 10 max attack
Goblin – 30 health – 5 max attack
Dragon – 100 health – 20 max attack
Enter your selection (Enter ‘stop’ to end the game): Troll
Monster exists
darin has 100 health remaining.
Please select one of the following monsters:
Troll – 75 health – 10 max attack
Goblin – 30 health – 5 max attack
Dragon – 100 health – 20 max attack
Enter your selection (Enter ‘stop’ to end the game):
Notes:
If you have any questions, you can email me at ddjapri@ayclogic.com
AYC Logic’s observed holidays: https://www.ayclogic.com/observed-holidays/