-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTruck.java
More file actions
45 lines (35 loc) · 869 Bytes
/
Truck.java
File metadata and controls
45 lines (35 loc) · 869 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
package test;
public class Truck extends Car {
private int weight;
public Truck() {
super();
// TODO Auto-generated constructor stub
}
public Truck(Point point, int speed) {
super(point, speed);
// TODO Auto-generated constructor stub
}
@Override
public void run(int hour) {
// TODO Auto-generated method stub
super.distance = getSpeed() * hour * 0.7;
}
@Override
public double calcToll() {
// TODO Auto-generated method stub
double result = super.distance * getWeight() * 0.12;
return result;
}
@Override
public void print() {
// TODO Auto-generated method stub
System.out.printf("트럭\t %d\t %.1f\t\t %d\t %d\t %.1f\t\n", getSpeed(), super.distance, getPoint().getX(),
getPoint().getY(), calcToll());
}
public int getWeight() {
return weight;
}
public void setWeight(int weight) {
this.weight = weight;
}
}