Question: COMP 1900 -Fall 2018 Lab 6 Homework: User-Defined Methods (15 pts) Number of People: Individual Due: By the beginning of next week's lab session Grader:

 COMP 1900 -Fall 2018 Lab 6 Homework: User-Defined Methods (15 pts)Number of People: Individual Due: By the beginning of next week's lab

COMP 1900 -Fall 2018 Lab 6 Homework: User-Defined Methods (15 pts) Number of People: Individual Due: By the beginning of next week's lab session Grader: Please refer to the COMP 1900 syllabus for your lab TA. Questions about grading? Contact him/her first! Coding Style: Use camelCase for variable names, use consistent indentation in your code, and include a reasonable amount of comments throughout your code. The TAs may deduct points for poor coding style Within the 1900 folder on your desktop, create a new folder named Lab6HW 1. (10 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 Pricin FREE $2.00 $1.00 $24.00 Within your Lab6HW 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 2. (5 pts) Within the same AirportParking.java file, write a main method that repeatedly asks the user to enter the number of minutes parked, until entering a negative sentinel value to exit. Each time the user enters a number of minutes parked, your main method should call the previously written parkingCharge mcthod and display the value returned. Your main method is the only one that should create a Scanner object and read user input. The parkingCharge method gets this information from its minutes argument

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!