Question
(+20) Provide a python program to determine the parking fees at the airport based on the following time constraints: Any amount of time less than
(+20) 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
240 16
420 14
600 20
Suggested template PLEASE modify as needed :
rate1 = 5 # $5 rate rate2 = 4 # $4 rate rate3 = 2 # $2 rate #various calculations using ROUND, INT % / // functions and operators
#these calculations can be removed from your final code
Illustrative purposes only
x = round(25.3456, 1) print("1 x == ", x) x1 = round(25.3456, 2) print("2 x1 == ", x1) y = int(24.88) print("3 y == ", y) z = 174 % 60195 print("4 Z == ", z) a = 33/60 print("5 a == ", a) b = 33//60 print("6 b == ", b) fee = 0.0 # initialize m = int(input(" Please enter number of minutes parked...")) if (0 < m and m <= 60 ): #table 1 hrs = int(m/60) + 1 fee = hrs*rate1 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): #calculations needed print('we are in table 3 fee == ', fee) else: print("error negative minutes", m )
1 x == 25.3
2 x1 == 25.35
3 y == 24
4 Z == 54
5 a == 0.55
6 b == 0
Please enter number of minutes parked...
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 and output the parking fee
Let m = minutes parked
fee = parking fee
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started