-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathPlane.java
More file actions
36 lines (30 loc) · 1005 Bytes
/
Plane.java
File metadata and controls
36 lines (30 loc) · 1005 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
28
29
30
31
32
33
34
35
36
public class Plane extends Vehicle {
public Plane(String powerType, int numWheels, int numDoors, String color, double fuelEconomy, int passangerCapacity) {
super("Plane", powerType, numWheels, numDoors, color, fuelEconomy, passangerCapacity)
boolean islandinggeardown;
isLandingGearDown = true;
}
public void takeoff() {
System.out.println("We have liftoff!");
isLandingGearDown = false;
}
public void prepToLand() {
isLandingGearDown = true;
}
public boolean land() {
if (isLandingGearDown) {
System.out.println("We have landed!");
return true;
} else {
System.out.println("Put the landing gear down.");
return false;
}
}
public static void main(String[] args) {
Plane cessna = new Plane("Pixie Dust", 6, 2, "White", 70, 4);
cessna.takeoff();
cessna.land();
cessna.prepToLand();
cessna.land();
}
}