-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSpaceCraft.java
More file actions
executable file
·92 lines (88 loc) · 1.83 KB
/
Copy pathSpaceCraft.java
File metadata and controls
executable file
·92 lines (88 loc) · 1.83 KB
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
class SpaceCraft {
private String name;
private int health, capacity, cost;
UserInterface ui = new UserInterface();
navigationQuality navQual;
shipQuality shipQual;
shipAge age;
shipSpeed speed;
fuelTankSize tankSize;
public static enum shipSpeed {
SLOW,
AVERAGE,
FAST
}
public static enum navigationQuality {
POOR,
AVERAGE,
OUTSTANDING
}
public static enum shipQuality {
POOR,
AVERAGE,
OUTSTANDING
}
public static enum shipAge {
VERY_OLD,
OLD,
AVERAGE,
NEW
}
public static enum fuelTankSize {
SMALL,
MEDIUM,
LARGE
}
public SpaceCraft(String name, shipAge age, shipSpeed speed, shipQuality shipQual, navigationQuality navQual, int capacity, int cost, int health, fuelTankSize tankSize) {
this.name = name;
this.age = age;
this.speed = speed;
this.shipQual = shipQual;
this.navQual = navQual;
this.capacity = capacity;
this.cost = cost;
this.health = health;
this.tankSize = tankSize;
}
public String getName() {
return name;
}
public shipAge getAge() {
return age;
}
public int getHealth() {
return health;
}
public int changeHealth(int modVal) {
health = health + modVal;
return health;
}
public shipQuality getQuality() {
return shipQual;
}
public shipSpeed getSpeed(){
return speed;
}
public int getCost(){
return cost;
}
public int getCapacity(){
return capacity;
}
public navigationQuality getNavQual() {
return navQual;
}
public void printAllSpecs(){
ui.println(name);
ui.println("Cost: " + cost);
ui.println("Capacity: " + capacity);
ui.println("Condition: " + shipQual);
ui.println("Speed: " + speed);
ui.println("= = = = = = = = =");
}
public class SaturnV extends SpaceCraft {
public SaturnV() {
super("Saturn V", shipAge.VERY_OLD, shipSpeed.SLOW, shipQuality.POOR, navigationQuality.POOR, 3, cost, health, fuelTankSize.SMALL);
}
}
}