Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write in Java 1. (9 pts) As indicated at http://www.flymemphis.com/parking,_Memphis International Airport uses the following pricing schedule for their short-term parking fees: Time First 30

Write in Java
image text in transcribed
1. (9 pts) As indicated at http://www.flymemphis.com/parking,_Memphis International Airport uses the following pricing schedule for their short-term parking fees: Time First 30 minutes 31 to 60 minutes Each additional 30 minutes 24-hour maximum Pricing FREE $2.00 $1.00 $24.00 Within your Lab7 folder, create a new file named AirportParking.java. Write a method public static int parkingCharge(int minutes) that takes a parameter for the number of minutes parked and returns the appropriate short-term parking charge, in dollars. Assume that the airport will always round UP to the next half-hour- 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, the 24-hour maximum charge should be applied to each complete day, and any partial day should be charged according to the schedule in the table. For example, parking for 1471 minutes would result in a charge of $26. The first 1440 minutes (24 hours) costs $24, the next 30 minutes is free, and the next 1 minute costs $2. Hint: Start by determining three things -1) how long it takes to reach the 24-hour maximum charge (it is NOT 24 hours), 2) how many full days are contained in the argument, and 3) how many 30-minute increments are contained in the partial day that's left over

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

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions