-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAirplane.java
More file actions
46 lines (29 loc) · 818 Bytes
/
Airplane.java
File metadata and controls
46 lines (29 loc) · 818 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
37
38
39
40
41
42
43
44
45
46
package semesterProject;
public class Airplane extends Vehicle{
Engine engine;
Cockpit cockpit;
Navigation nav;
fuelTank tank;
Airplane(String name , int capacity,Engine engine , Navigation nav) {
super(name,capacity);
this.engine=engine;
this.nav =nav;
tank = new fuelTank();
tank.plane = this;
//Composition Aggregation(Engine)
cockpit = new Cockpit(this.engine,this.nav,tank);
cockpit.plane = this;
//Aggregation
nav.plane = this ;
}
boolean checkStatus() {
return engine.isRunning();
}
public String toString() {
return "Name of Plane : " + getName() + "\nCapacity : "+getCapacity() ;
}
public void setNavigation(Navigation nav) {
this.nav = nav;
this.nav.plane = this;
}
}