The parking billing program is a program implemented according to the charging standards of a certain parking lot. The program is based on the driver's vehicle type (motorcycle or car), car type (sports car or sedan), parking date (weekdays or weekends), discount coupons Calculate the parking fee with the parking time.
- Input specifications
Input | type | limits | Description |
typeOfVehical | int | only the numbers 0, 1 0, 1 | represent motorcycles and cars respectively |
typeOfCar | int | only the numbers 0,1 0,1 | represent sports cars and cars respectively |
dayOfWeek | int | only the numbers 0,1 0,1 | represent weekdays and weekends respectively |
apd | double | only a real number between 0-24 | Actual parking time |
discountCoupon | boolean | whether to use a coupon | |
estimation | String | is only: "(0.0,2.0]", "(2.0,4.0]", "(4.0,24.0]", null | The estimated parking time of the driver, divided into four time periods, where null means that the driver did not give an estimate Estimate parking time. |
- Output specifications
Call the parking fee interface of the program to get the double output parameter fee. The output result is divided into three situations according to the input:
(a) The user provides coupons: When the user provides coupons, they can enjoy a 50% discount on the original parking fee.
(b) The user chooses the estimated parking time: The user can choose the estimated parking time according to his situation, divided into three time periods, "no more than 2 hours", "2 hours to 4 hours" and "4 hours to 24 hours". If the parking time is within the estimated time, the driver can enjoy a 40% discount. On the contrary, the driver needs to pay an additional 20% additional management fee in addition to the original parking fee.
(c) The user has neither coupons nor estimated parking time: If the driver does not provide coupons or estimated parking time, the parking fee will not be discounted. It should be noted that the user cannot give the estimated parking time while providing the coupon, and can only choose one preferential method or neither.
When the input meets the program specifications, the final parking fee is calculated according to the parking time, whether to enjoy a discount and the parking unit price. The calculation method of the parking unit price is shown in the table.
Parking time(Unit: hour) | Parking unit price (unit: ¥) | |||||
Weekday | weekend | |||||
Motorcycle | sports car | sedan | motorcycle | sports car | sedan | |
(0.0,2.0) | 4.00 | 4.50 | 5.00 | 5.00 | 6.00 | 7.00 |
(2.0,4.0) | 5.00 | 5.50 | 6.00 | 6.50 | 7.50 | 8.50 |
(4.0,24.0) | 6.00 | 6.50 | 7.00 | 8.00 | 9.00 | 10.00 |
- Description of MRs
A total of 5 MRs are shown in the table.
No. | R | Rf |
1. estimation="(0.0,2.0]" | ||
MR1 | apd_=apd+0.1(0.0 < apd<=1.9) | fee_>=fee |
2. estimation="(2.0,4.0]" | ||
MR2 | apd_=apd+0.1(2.0<apd<=3.9) | fee_>=fee |
3. estimation="(4.0,24.0]" | ||
MR3 | apd_=apd+0.1(4.0<apd<=23.9) | fee_>=fee |
4. estimation=null | ||
MR4 | apd_=apd+0.1(0.0<apd<=23.9) | fee_>=fee |
5. Attribute MR | ||
MR5 | apd_=ceil(apd)(0.0<apd<=24.0) | fee_=fee |
Note:The ceil() in MR5 stands for rounding up.