An airport uses the following pricing scheme for their short term parking fees.
ID: 3539418 • Letter: A
Question
An airport uses the following pricing scheme for their short term parking fees.
Time Pricing
First 30 minutes FREE
31 to 60 minutes $2.00
Each additional 30 minutes $1.00
24-hour maximum $21.00
Write a method that takes a parameter for the number of minutes parked ( you can assume it%u2019s a whole number) and returns the appropriate short term parking charge in dollars. Assume that the airport will always round up to the next half hour %u2013 for example, parking exactly 60 minutes would cost $2, but 61 minutes would make it $3. After all, they want to make as much money as possible!
If the method is called with a zero or negative argument, make it return zero. If the method is called with an argument exceeding 24 hours, make it return the 24-hour maximum listed in the table.
You do not need to write a separate main method for this program , but be sure to thoroughly test your pricing method by calling it from the compiler.
Explanation / Answer
Sample output
34
Total price you have to pay is : 2.0
67
Total price you have to pay is : 3.0
178
Total price you have to pay is : 6.0
1868
You exceeded 24 hour limit
Total price you have to pay is : 21.0
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.