- This event has passed.
5 PM – Intro to Java – William
July 28, 2023 @ 5:00 pm - 7:00 pm
Today we did:
- Reviewed HW and Practice Quiz
- Quiz 🙂
- Started MonsterInheritance
- Created run() method
Homework:
- Create a Monster class:
- Monsters should have 3 attributes:
- String species
- int health
- int maxAttack
- Create getter and setter methods
- Create a constructor
- Create a doDamage() method:
- Has 1 int parameter that subtracts specified value from the monster’s health
- Create a heal() method:
- Same as doDamage() but adds to monster’s health
- Monsters should have 3 attributes:
- Implement listAllMonsters() in MonsterInheritanceMain.java:
- For each monster, if the Monster is dead (health is <= 0), then print: “- (monster species) – Dead”
- Otherwise print “- (monsterspecies) – (monster health) health”
- Create a main() method that calls run()
Might be hard to test this week’s homework, so don’t worry if you can’t 🙂
If you have any questions, please email me at williamsmith@ayclogic.com