Project3 :
Intro to Inheritance

Due: April 5th at 11:59pm


Summary: It is time to start working with inheritance. I have scaled this project down because we are now all remote. You can think of this project and the beginning scaffolding of a game that one could build on (and I thought I would this semester, but with our adjustments I don't think we will have time even with the 4 credit nature of our class)


Details:


UML diagram for project 3


Implement the 6 classes in the UML diagram above. More details are below. Each class is fairly simple, work on them one at a time and check them into github so you don't lose stuff.

You may add any additional *non-public* methods that you want (including 'package protected')

I haven't specified most of the constructors in the UML. I'm leaving it up to you  whether to pass parameters or create objects in the constructors themselves.

The Weapon Class:

The constructor for this class take the two parameters and needs to set the two instance variables.

The other two methods are just basic accessor methods.


Game:

The Game class is the main driver class, much like the DayCareFacility from the last project.

main: You can either have a main class or put the main method here. It should create a game object and then call runGame (and that is all it should do)

Game Constructor: The constructor should create a player object and three enemies, two basic Enemy object and one Boss object.

runGame: should have the player attack one of the enemies in the list (you the developer choose one to make it easier for you), then loop through the bad_guys list and have all of them attack the player. we'll leave it at just one attack each to simplify things


GameEntity: This is an abstract class.

health should be protected to make it easy to work with across the class hierarchy

Attack: this is an abstract method, you should have public void Attack(GameEntity target); and that is all

getHit: this is also and abstract method


Player:

This class extends GameEntityand implements/overrides the two abstract methods.

Player constructor. Make a constructor that somehow fills the myWeapon instance variable with a weapon object. You can either receive it as a parameter or create a new object in the constructor itself.

Attack: should call getHit on the target, you should pass the myWeapon damage as the damage in getHit on the target

getHit: lets say the player is armored, so this get hit should reduce the players health by half of the damage passed. (make sure you are using the protected health instance variable inherited from game entity.


Enemy:

This class extends GameEnitity and implements/overrides the two abstract methods.

Enemy Constructor should set heath to something fairly low and damage to around 1/10 of the players starting health

Attack: call getHit on the target GameEntity passing flat_damage as the parameter to getHit

getHit: should reduce health by the damage paramter


Boss:

Boss Constructor should initialize flat_damage to twice what you use for the Enemy value and initialize health to about what you gave the player for starting health

Attack: should call getHit on the target GameEntity passing twice the value of flat_damage as the parameter to getHit


Additional Requirements:


Submission:

Submit by sharingthe project with me on github as you did last time.