forked from rick2785/JavaCode
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEnemyShipBuilding.java
More file actions
27 lines (19 loc) · 788 Bytes
/
EnemyShipBuilding.java
File metadata and controls
27 lines (19 loc) · 788 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
public abstract class EnemyShipBuilding {
// This acts as an ordering mechanism for creating
// EnemyShips that have a weapon, engine & name
// & nothing else
// The specific parts used for engine & weapon depend
// upon the String that is passed to this method
protected abstract EnemyShip makeEnemyShip(String typeOfShip);
// When called a new EnemyShip is made. The specific parts
// are based on the String entered. After the ship is made
// we execute multiple methods in the EnemyShip Object
public EnemyShip orderTheShip(String typeOfShip) {
EnemyShip theEnemyShip = makeEnemyShip(typeOfShip);
theEnemyShip.makeShip();
theEnemyShip.displayEnemyShip();
theEnemyShip.followHeroShip();
theEnemyShip.enemyShipShoots();
return theEnemyShip;
}
}