-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcar1.java
More file actions
33 lines (27 loc) · 884 Bytes
/
car1.java
File metadata and controls
33 lines (27 loc) · 884 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
public class car1 extends Vehicle{
private int wheels;
private int doors;
private int gears;
private boolean isManual;
private int currentGears;
public car1(String name, String size, int wheels, int doors, int gears, boolean isManual) {
super(name, size);
this.wheels = wheels;
this.doors = doors;
this.gears = gears;
this.isManual = isManual;
this.currentGears = 1;
}
public void changeGears(int currentGears) {
this.currentGears = currentGears;
System.out.println(" car.setCurrentgear(): Changed to"+this.currentGears+"gear");
}
public void changeVelocity(int speed, int direction){
System.out.println("Car.changeVelocity() "+speed+" Direction "+direction);
move(speed,direction);
}
@Override
public void stop() {
super.stop();
}
}