-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTaxi.java
More file actions
44 lines (35 loc) · 876 Bytes
/
Taxi.java
File metadata and controls
44 lines (35 loc) · 876 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
package test;
public class Taxi extends Car {
private int taxifare;
public Taxi() {
super();
// TODO Auto-generated constructor stub
}
public Taxi(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;
}
@Override
public double calcToll() {
// TODO Auto-generated method stub
double result = super.distance * getTaxifare() * 0.023;
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 getTaxifare() {
return taxifare;
}
public void setTaxifare(int taxifare) {
this.taxifare = taxifare;
}
}