Question: Three files: Garage.java , GarageTest.java , Plane.java . At the beginning of all of your programs, put your name and a brief description of the
Three files: Garage.java, GarageTest.java, Plane.java.
At the beginning of all of your programs, put your name and a brief description of the program.
Example:
/*Sally Smith
This program will calculate area of a
triangle, etc...*/
Add many comments to the body of your code so as to demonstrate a thorough understanding of your program.
SECTION 1: Parking Garage Charge
A parking garage charges a two dollar 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 3 hours. The maximum charge for any given 24 hour period is $10. Assume that no car parks for longer than 24 hours at a time. Write an application that calculates and displays the parking charges for each customer who parked in the garage yesterday. You should enter the hours parked for each customer. The program should display the charge for the current customer and should calculate and display the running total of yesterday's receipts. It should use the method calculateCharges to determine the charge for each customer.
SECTION 2: Airline Reservation System
A small airline has just purchased a computer for its new automated reservations system. You've been asked to develop the new system. You are to write an application to assign seats on each flight of the airline's only plane (capacity: 10 seats).
Your application should display the following alternatives: "Please type 1 for First Class and Please type 2 for Economy." If the user types 1, your application should assign a seat in the first-class section, which is seats 1 through 5. If the user types 2, your application should assign a seat in the economy section, which is seats 6 through 10. Your application should then display a boarding pass indicating the person's seat number and whether it is in the first class or economy section of the plane.
Use a one-dimensional array of primitive type boolean to represent the seating chart of the plane. Initialize all the elements of the array to false to indicate that all the seats are empty. As each seat is assigned, set the corresponding element of the array to true to indicate that the seat is no longer available. Your application should never assign a seat that has already been assigned. When the economy section is full, your application should ask the person if it is acceptable to be placed in the first class section and vice versa if the first-class section is full and there are seats available in economy. If yes, make the appropriate seat assignment. If no, display the message "Next flight leaves in 3 hours."
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
