A rental service offers 3 types of vehicles: Car, Bike, Truck. Each type has a different fee formula based on the number of rental days.
Vehicle with:
plate (String) — license platemodel (String) — model namedouble rentalFee(int days)Car extends Vehicle:
dailyRate (double)rentalFee(days) = dailyRate * daysdays >= 7, apply a 10% discount.Bike extends Vehicle:
dailyRate (double)rentalFee(days) = dailyRate * days * 0.6 (40% cheaper than a car)Truck extends Vehicle:
dailyRate (double)loadKg (double) — cargo weightrentalFee(days) = dailyRate * days + loadKg * 50 (load surcharge)main:
<type> <plate> <model> <dailyRate> [<loadKg>] (loadKg only for TRUCK).<plate> <days>.<plate> <fee> (2 decimal places).TOTAL <total fee> (2 decimal places).CAR <plate> <model> <dailyRate> or BIKE <plate> <model> <dailyRate> or TRUCK <plate> <model> <dailyRate> <loadKg><plate> <days><plate> <fee> (2 decimal places)TOTAL <sum>Ví dụ:
Đầu vào:
3
CAR 29A1 Vios 500000
BIKE 29B2 SH 200000
TRUCK 29C3 Hino 800000 1000
3
29A1 3
29B2 5
29C3 2
Đầu ra:
29A1 1500000.00
29B2 600000.00
29C3 1650000.00
TOTAL 3750000.00
Giải thích:
Đầu vào:
1
CAR 50A123 Camry 1000000
1
50A123 10
Đầu ra:
50A123 9000000.00
TOTAL 9000000.00
Giải thích:
Đầu vào:
2
BIKE B1 Wave 100000
BIKE B2 Exciter 150000
2
B1 3
B2 7
Đầu ra:
B1 180000.00
B2 630000.00
TOTAL 810000.00
Đầu vào:
1
TRUCK T1 Big 1000000 5000
1
T1 1
Đầu ra:
T1 1250000.00
TOTAL 1250000.00
Giải thích:
Đầu vào:
3
CAR C1 X 300000
CAR C2 Y 400000
CAR C3 Z 500000
3
C1 7
C2 14
C3 6
Đầu ra:
C1 1890000.00
C2 5040000.00
C3 3000000.00
TOTAL 9930000.00
Giải thích:
Đầu vào:
1
CAR X1 Mio 100000
1
X1 365
Đầu ra:
X1 32850000.00
TOTAL 32850000.00
Giải thích:
Đầu vào:
3
CAR C1 a 100000
BIKE B1 b 100000
TRUCK T1 c 100000 0
3
C1 7
B1 7
T1 7
Đầu ra:
C1 630000.00
B1 420000.00
T1 700000.00
TOTAL 1750000.00
Giải thích:
Đang tải editor...