Provide a python program to determine the parking fees at the airport based on t
ID: 3889992 • Letter: P
Question
Provide a python program to determine the parking fees at the airport based on the following time conditions: ( Beginner PYTHON) (PLEASE USE SUGGESTED TEMPLATE)
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 or 55 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
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. 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
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. This means:
Minutes parked
Hrs*Fee = parking fee
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
Suggested template:
x == 25.0
x1 == 25.0
y == 24
Z == 2
a == 0.55
Please enter number of minutes parked...33
Parking fee for 33 minutes is $ 5
Algorithm :
Input: minutes parked
Output: Parking fee
Your program should ask the user how many minutes they parked, use the result of your calculations with the various operators to determine which case 1, 2 3 the minutes falls into and output the parking fee
Several if statements may be needed as well as AND OR operators
Let m = minutes parked
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
Explanation / Answer
# Python code to determine the parking charge
import math # This will import math module
time = float(raw_input("Enter the amount of time parked: "))
time = (math.ceil(time/60))
print time
charge = 0.0
if time > 5:
charge = time*2
elif time > 1:
charge = time*4
elif time > 0:
charge = time*5
print "Parking Charge: ", charge,"$"
'''
output:
Enter the amount of time parked: 25
Parking Charge: 5.0 $
Enter the amount of time parked: 05
Parking Charge: 5.0 $
Enter the amount of time parked: 55
Parking Charge: 5.0 $
Enter the amount of time parked: 65
Parking Charge: 8.0 $
Enter the amount of time parked: 95
Parking Charge: 8.0 $
Enter the amount of time parked: 120
Parking Charge: 8.0 $
Enter the amount of time parked: 135
Parking Charge: 12.0 $
Enter the amount of time parked: 240
Parking Charge: 16.0 $
Enter the amount of time parked: 300
Parking Charge: 20.0 $
Enter the amount of time parked: 825
Parking Charge: 28.0 $
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.