Specification

  1. Create Animal.java class which has the following attributes
    1. String species
    2. int attack
    3. int health
    4. Create constructor and getter and setter
    5. Create a method “fight” with 2 parameters: Animal, String location
      1. this method will take animal.getAttack() subtract this animal health.
  2. Create Bull.java class
    1. This class should inherit from the Animal class.
    2. The constructor should have no parameter. The constructor should call the parent constructor (super) with the following parameters:
      1. species:  “Bull”
      2. attack: 6
      3. health:120
  3. Create Crocodile.java class
    1. This class should inherit from the Animal class.
    2. The constructor should have no parameter. The constructor should call the parent constructor (super) with the following parameters:
      1. species:  “Crocodile”
      2. attack: 8
      3. health:100
  4. Create Lion.java class
    1. This class should inherit from the Animal class.
    2. The constructor should have no parameter. The constructor should call the parent constructor (super) with the following parameters:
      1. species:  “Lion”
      2. attack: 10
      3. health:90
  5. Create AnimalFightSystem.java class
    1. It will have a list of Animal.
    2. This class will have a run method
      1. You will create one Crocodile, one Bull, and one Lion objects or variables. Add all of them into the list of Animal.
      2. This will allow the user to choose 2 animals to fight.
      3. The program will list all the animals inside the List for user to choose from.
    3. After 2 animals are chosen, the program will randomly choose either “land” or “water” location for their fighting location.
    4. After this, both animals will attack each other by calling each other fight method

Expected Outcome

CHOOSE 2 ANIMALS TO FIGHT: 
Choose your 1st animal: 
0. Crocodile - Attack 8 - Health 100
1. Bull - Attack 6 - Health 120
2. Lion - Attack 10 - Health 90
Enter your selection: 0

Choose your 2nd animal: 
0. Crocodile - Attack 8 - Health 100
1. Bull - Attack 6 - Health 120
2. Lion - Attack 10 - Health 90
Enter your selection: 1
Crocodile and Bull are fighting in water
Crocodile remaining health is 97. Bull remaining health is 104
******************

CHOOSE 2 ANIMALS TO FIGHT: 
Choose your 1st animal: 
0. Crocodile - Attack 8 - Health 97
1. Bull - Attack 6 - Health 104
2. Lion - Attack 10 - Health 90
Enter your selection: 2

Choose your 2nd animal: 
0. Crocodile - Attack 8 - Health 97
1. Bull - Attack 6 - Health 104
2. Lion - Attack 10 - Health 90
Enter your selection: 1
Lion and Bull are fighting in water
Lion remaining health is 78. Bull remaining health is 84
******************

CHOOSE 2 ANIMALS TO FIGHT: 
Choose your 1st animal: 
0. Crocodile - Attack 8 - Health 97
1. Bull - Attack 6 - Health 84
2. Lion - Attack 10 - Health 78
Enter your selection: