Final Project Specifications
Final Project Specifications
The main purpose of this project is a simple abstract java program for a Strategy game against
two teams. Constructing a class Soldier.java and depriving it of the classes RedArmy.java and
BlueArmy.java, with the main class StrategyGame.java, and testing the program with class
ArmyResult.java.
1. Making the class Solider abstract in the beginning, and declaring the statement unit and
number private and the other statements armyKind, marchSpeed, marchModifier into public.
2. Next, build a constructor Soldier class with no parameter and set parameters in the private unit
statement with “AA” and private number statement with zero(0).
3. Build a constructor Soldier class with parameters for String unit and integer(int) number and
use the input parameters to set the fields unit and number. Next set statement marchSpeed to 6.
6. Create a boolean attack(Soldier target, int roll) to list the logic of the program of attack
patterns.
1. If the current object and the target are the same OR if the roll equals to 1 then it print out
to the current string to the results of “of damaging themselves” and “hurt themselves out
of confusion” and return true
2. If the current object is RedArmy(titans) and the target is the BlueArmy(gods) then the
results print out “rolled out [int] against the gods”. And return true if {roll} >= 18 AND
{roll} is even. Same parameter for if loop for #3 and #4
3. If the current object is RedArmy(titans) and the target is the RedArmy(titans) then the
results print out “No traitors are here”. And return false
4. If the current object is RedArmy(titans) is equal to itself then it print out “Acceptable
Collateral Damage”. And return true
5. If the current object is BlueArmy(gods) and the target is the BlueArmy(gods) then the
results print out “Olympus spy”. And return false
6. If the current object is BlueArmy(gods) and the target is the RedArmy(titans) then the
results print out “rolled a [int] a against the titans”. And return true if {roll} > 5 OR roll is
odd
7. If the current object is BlueArmy(gods) equals to itself then the results print out “The
gods killed a mortal bystander”. And return true if {roll} >= 18 AND {rol} is even
7. Create getters and setters methods of all statements and the equals and hashCode methods
for the program.
1. Create the RedArmy to extends Soldier class that turn the String name delcared “underworld”
and integer(int) troopCount set zero(0) to private, and double marchModifier to public.
2. Build RedArmy method with the parameter field to String name and int count, and use the
constructor from the parent class to set the fields unit and count. Next, increment the
TroopCount and the set ArmyKind to “Titans” and then set marchModifier to 1.45
3. Create setters and getters for the standard autogenerated methods in the program
4. Create march(double duration) that returns the duration from the duration multiplied by
marchModifier and marchSpeed
5. Create toString() to return the name of the current object with with the value returned from
the toString of the parent class and the value of the armyKind
1. Create the BlueArmy class extends to Soldier class and set the String name to “Olympus” and
private and the troopCount is private and static and set to zero(0).
2. Set the constructor BlueArmy with the parameter of String armyKind, int counter, String
nameCreate and create the following actions:
1. Uses the constructor from the paent class to set the fields unit and number
2. Set the armyKind to “Gods”, marchModifier to 1.10, and name to the parameter value
passed in
3. Create setters and getters methods to autogenerate methods for the program
4. Create march(double duration) that returns the duration from the duration multiplied by
marchModifier and marchSpeed
5. Create toString() to return the name of the current object with with the value returned from
the toString of the parent class and the value of the armyKind
Lastly build the main class named StrategyGame and set the statements to for both classes of
RedArmy and BlueArmy. And build test class named SoldierTest with test methods and setter
and getter method to require the results for the program.
Output:
Blue army gods: 3
Red army titans: 3
{AA=[white(AA0:) a Gods, blue(AA0:) a Gods], hyperion=[hyperion(hyperion2:) a Titans],
cronus=[cronus(cronus1:) a Titans]}
white(AA0:) a Gods
white(AA0:) a Gods Marched 110.0 meters
white(AA0:) a Gods is attatcking AA
white(AA0:) a Gods rolled a 16
white(AA0:) a Gods a solider is targeting themselve...
white(AA0:) a Gods rolled a 16 and took damage itself
Hit!
Miss!
Miss!
Miss!
blue(AA0:) a Gods
blue(AA0:) a Gods Marched 0.0 meters
Miss!
blue(AA0:) a Gods is attatcking AA
blue(AA0:) a Gods rolled a 12
blue(AA0:) a Gods a solider is targeting themselve...
blue(AA0:) a Gods rolled a 12 and took damage itself
Hit!
Miss!
Miss!
hyperion(hyperion2:) a Titans
hyperion(hyperion2:) a Titans Marched 87.0 meters
Miss!
Miss!
hyperion(hyperion2:) a Titans is attatcking hyperion
hyperion(hyperion2:) a Titans rolled a 12
hyperion(hyperion2:) a Titans a solider is targeting themselve...
hyperion(hyperion2:) a Titans rolled a 12 and took damage itself
Hit!
Miss!
cronus(cronus1:) a Titans
cronus(cronus1:) a Titans Marched 174.0 meters
Miss!
Miss!
Miss!
cronus(cronus1:) a Titans is attatcking cronus
cronus(cronus1:) a Titans rolled a 19
cronus(cronus1:) a Titans a solider is targeting themselve...
cronus(cronus1:) a Titans rolled a 19 and took damage itself
Hit!