Question: (+30) Provide a python program to determine the parking fees at the airport based on the following time constraints: Any amount of time less than
(+30) Provide a python program to determine the parking fees at the airport based on the following time constraints:
- Any amount of time less than or equal to one hour, the parking fee is 5.00. This means if your parked for 5, 15, 55 or 60 minutes you pay $5.00
| Minutes parked | Hrs*Fee=parking fee |
| 25 minutes (0 hour and 25 minutes) | 1*5.00 |
| 05 minutes (0 hour and 5 minutes) | 1*5.00 |
| 55 minutes (0 hours and 55 minutes) | 1*5.00 |
| 30 minutes (0 hour and 30 minutes) | 1*5.00 |
| 10 minutes (0 hour and 10 minutes) | 1*5.00 |
| 60 minutes (1 hour and 0 minutes) | 1*5.00 |
- Any amount of time greater than one hour but less than or equal to 5 hours (300 minutes), the parking fee is 4.00 per hour and any fraction thereof. This means:
| Minutes parked | Hrs*Fee=parking fee |
| 65 minutes (1 hour and 5 minutes) | 2*4.00 |
| 95 minutes (1 hour and 35 minutes) | 2*4.00 |
| 120 minutes (2 hours) | 2*4.00 |
| 135 minutes (2 hour and 15 minutes) | 3*4.00 |
| 180 minutes (3 hour and 0 minutes) | 3*4.00 |
| 195 minutes (3 hour and 15 minutes) | 4*4.00 |
| 240 minutes (4 hours) | 4*4.00 |
| 260 minutes (4 hours 20 minutes ) | 5*4.00 |
| 300 minutes (5 hours) | 5*4.00 |
- Any amount of time greater than 5 hours, the parking fee is 2.00 per hour and any fraction.
| Minutes parked | Hrs*Fee = parking fee |
| 320 minutes (5 hour and 20 minutes) | 6*2.00 |
| 400 minutes (6 hour and 40 minutes) | 7*2.00 |
| 800 minutes (13 hour and 20 minutes) | 14*2.00 |
| 825 minutes (13 hour and 45 minutes) | 14*2.00 |
| 600 minutes (10 hours) | 10*2.00 |
Use the following test cases to make sure the results of your code are as expected
Minutes parked Cost
60 5
120 8
300 20
301 12
240 16
420 14
600 20
Suggested template PLEASE modify as needed: fee = 0.0 # initialize
f1 = 5.0 # table 1 fee
f2 = 4.0 # table 2 fee
f3 = 2.0 # table 3 fee m = int(input(" Please enter number of minutes parked...")) if (0 < m and m <= 60 ): #table 1 minutes # hrs = int(m/60) + 1 fee = f1 print("Parking fee for ", m, " minutes is $", fee) # now for table 2 elif (m > 60 and m <= 300): # table 2 # calculations needed print('we are in table 2 fee is ', fee) elif ( m > 300): # table 3 #calculations needed print('we are in table 3 fee == ', fee) else: print("error negative minutes", m ) OUTPUT
Please enter number of minutes parked...195
we are in table 2 fee is 0.0
Algorithm :
Input: minutes parked
Output: Parking fee
Your program should ask the user for minutes parked, use the various functions/operators as needed to determine in which table 1, 2 3 the minutes falls into, compute the fee and output the parking fee
Let m = minutes parked
fee = parking fee
Please make sure your code uses the constants: f1 f2 f3
Once you have determined your algorithm, try it for several of the minute examples provided in the tables above for accuracy
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
