- Create a new Java class called Monster.
- It needs to have the following attributes: name, species, health.
- Create getters and setters methods for these attributes.
- Create additional methods:
- “heal” with one parameter, “count”. Inside the function, add parameter “count” to attribute “health”.
- “damage” with one parameter, “count”. Inside the function, subtract parameter “count” from attribute “health”.
- Create a new Java class called MonsterSystem.
-
Welcome to AYCLOGIC Monster System
Please select one of the following monsters:
- Troll - 50 Health remaining
- Orc - 30 Health remaining
- Dragon - 100 Health remaining
- Exit
Enter your selection: troll
What do you want to do with the Troll:
1. Damage
2. Heal
Enter your selection: 1
How much damage do you want to damage the Troll: 10
You damaged the Troll and it has 40 healths remaining.
Please select one of the following monsters:
- Troll - 40 Health remaining
- Orc - 30 Health remaining
- Dragon - 100 Health remaining
- Exit
Enter your selection: orc
What do you want to do with the Orc:
1. Damage
2. Heal
Enter your selection: 2
How much points do you want to heal the Orc: 5
You healed the Orc with 5 health points. It now has 35 healths remaining.
Please select one of the following monsters:
- Troll - 40 Health remaining
- Orc - 35 Health remaining
- Dragon - 100 Health remaining
- Exit
Enter your selection: exit
Thank you for using AYCLOGIC Monster system.