Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

PYTHON please answer asap! ill be leaving a thumbs up ! problem 3 Problem 3 [20 points ] Long term parking charges calculator. In this

PYTHON
please answer asap!
ill be leaving a thumbs up !
problem 3
image text in transcribed
image text in transcribed
Problem 3 [20 points ] Long term parking charges calculator. In this problem, you are asked to write a program to calculate and print the total parking charges for a customer at a long term parking lot. The chargea are calculated according to the tumber of days parked at the lot. The parking charges for the first 15 days of are $10 per day. After that, the charges are $6 per day. For example, if a cuatomer parks at the lot for 12 diays, the total clarge would be $120. If the customer parks at the lot for 21 days, it would cost $150 (for the first 15 days) +$36 (for the remaining 6 days), for a total charge of $186. You are asked to write a function whoee parameters are the date on which the customer enters the parking lot and the date on which s/he exita the lot. The function then prints out the total parking charges for the enatomer. Purther details are provided below. Write a function called parking_charges with four parameters: enternonth, enterday, exi taonth, and exitday. The customer enters the parking lot on the date enteraonth/enterday, and exits the parking lot on the date exitmonth/exitday. (We will sesume that the customer enters and exits the parking lot in the same calendar year.) Your function abould then print out, in a uaer-friendly way, the total parking claarges for the custotner. Some points to notes - Bach of the four parainetens to the function is a positive integer, where entermonth and oxitaonth are integens in the minge 1 to 12 , and enterday and exitday are approprinte day valuee for the corregonding month. Obviously, not all month/day values are valid. For example, dates such as 4/31 or 15/12 or 1/32 are all invalid. You mut chock for Oie vialuity of the enter and erit dates. (Assume that February alwiyn has 28 days.) If wither date is invalid, print a stmituble mesasge and return. - The exit date mint come affer the enter date. You are royuirul to chook for thir condition. If the exit date does not occur after the enter date, your function dhould print an appropriate croe mesouge and return (Aee stmple run below). Since we are neauining that the customer enters and exits the parking lot in the same calmadar year, thir ineanis that exit month must be greater this or nqual to the enter month. - Ir the exit date coses after the enter diate, your function should than proceed to calculnte the parking cluarges. When calculating the total tatuber of days parked, the dayn ou which the custotber euters and rexits are incluiel in the total count. For example, ir the castoner enteni on 4/15 and exita on 4/16, s/le parks for a total of two days. When cakculating the total number of dayn parked, wake mure that you count the number of dayn in each month cotrectly. Again, assume that Feliruary always han 28 diys, A a artomer may park for any number of diyns (op to 365). Use itring formatting to mase that the output in priniesl in a peatly formatted way. Important note: You are encouraged to implement additional helper functions to make your implementation of the parking_charges function more modnlar. Some points of the grading rubric for this problem will be reserved for your program design. See below for output from sample runs of the parking_charges function. > parking_charges (4,15,4,26) Total number of days parked: 12 12 days at $10 per day: $120 0 days at $6 por day: $10 Total charges: $120 > parking_charges (2,1,5,1) Total number of days parked: 90 15 days at $10 por day: $150 75 days at $6 per day: $450 Total charges: 560 parking_chargen (5,25,5,1) Invaliall Exit date occurn before onter date

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

SQL Server Query Performance Tuning

Authors: Sajal Dam, Grant Fritchey

4th Edition

1430267429, 9781430267423

Students also viewed these Databases questions

Question

What is the general purpose of preliminary screening?

Answered: 1 week ago