Design a modular program in Python to process parking charges . A parking garage charges $2.00 minimum fee to park for up to three hours. The garage charges an additional $0.50 per hour for each hour...

1 answer below »


Design a modular program in Python to process parking charges. A parking garage charges $2.00 minimum fee to park for up to three hours. The garage charges an additional $0.50 per hour for each hour or part thereof in excess of three hours. The maximum charge for any given 24-hour periodis $10.00. Assume that no car parks for longer than 24 hours at a time.



Write a Pythonprogram that calculates and displays the parking charges for each customer who parked yesterday and number of customers parked and total charges collected from those customers as well.



The program should contain a main function and a calculate_charge function. Themainfunction is to maintain the number of customers and total charges. And also, when there is more customer, the main should prompt user to enter the hours that customer parked, and then call the calculate_charge function to figure out charge to that customer. Thecalculate_chargefunction should return the charge amount based on the argument (hours_parked)it receives.

Answered Same DayJul 29, 2021

Answer To: Design a modular program in Python to process parking charges . A parking garage charges $2.00...

Neha answered on Jul 30 2021
142 Votes
import math
def calculateCharge(CarHours):
charge = 0
if CarHours <= 3.0:
charge
= 2.0
else:
charge = 2.0 + 0.5 * math.ceil(CarHours - 3.0)

if charge > 10.0:
charge = 10.0;

return charge
def main():
totalHours = 0
totalCharges = 0
Car1Hours = 0
Car1Charges = 0
Car2Hours = 0
Car2Charges = 0
Car3Hours...
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here