Question: Java 1 final Flight array system helpppp ReservationSystem Class: The class should store an ArrayList of Reservations addReservation: Takes as input last name, first name,
Java 1 final Flight array system helpppp
ReservationSystem Class: The class should store an ArrayList of Reservations
addReservation: Takes as input last name, first name, price, seat number and seat letter and creates a Reservation with this information. Add the reservation to the list of reservations.
addReservation: Prompts the user for the info needed to make a new reservation. Add the reservation to the list of reservations.
findReservation: find a reservation by first and last name and returns it
viewReservations: prints all reservations using System.out. Use the print method provided by Reservation
uploadReservations: asks the user for a file and reads in all the reservations from a file and saves them in the ArrayList. Uses the addReservation method for help.
downloadReservations: takes a file as input and writes the reservations to the file. Use the print method provided by Reservation
updateReservation: asks the user for the first and last name of the reservation to update and then asks for the data to be updated and updates the reservation.
getTotalPrice: Calls getPrice on each individual Reservation and adds them all up
Option 1: Upload Reservations If the user chooses this option, the program will a. Prompt the user for the file that contains the reservations. b. Read in the records into the ReservationSystem. Input File Format: LastName FirstName Price SeatNumber SeatLetter Sample Input File: Bob Mike 200 23 B Matt Benjamin 178 15 A Keller Helen 135.99 6 D Tim Mary 210.77 12 B Use the uploadReservations method to upload the reservations to the ReservationSystem.
Option 2: New Reservation This option will prompt the user for the information needed to make 1 reservation and store it in the ReservationSystem. You need to make sure that the seat number is between 1-30. You need to make sure the seat letter is either A, B, C, D or E.
Option 3: Update Reservation When this option is selected, the program will ask for the first and last name of the reservation and prompt the user for the seat number and seat letter. Use the updateReservation method for this task.
Option 4: View All Existing Reservations If the user chooses this option, the program will print to the screen all the reservations information. Use the viewReservations method for this task. Sample Output: Name: Mike Bob, Price: 200, Seat: 23B Name: Benjamin Matt, Price: 178, Seat: 15A Name: Helen Keller, Price: 135.99, Seat: 6D Name: Mary Tim, Price: 210.77, Seat: 12B
Option 5: Find Reservation If the user chooses this option, the program will prompt the user for their first and last name and search for a reservation with that first and last name combination and display it to the screen. If no reservation is found, a message will be displayed indicating that. Use the findReservation method for this task
Option 6: Download Statistics If the user chooses this option, the program will create a statistics file with the following data: a. Printout of all reservations use the downloadReservations method for this task b. Sorted customer names alphabetically (by last name) c. Lowest flight price d. Highest flight price e. Total cost of reservations use the getTotalPrice method in the ReservationSystem class
The statistics file will have the same name as the input file (from option 1) but with _stats.txt appended to it. For example, if the input file was named reservations.txt, the stats file will be named reservations_stats.txt. Note: It will remove the .txt from reservations.txt, before adding the _stats.txt. It will NOT create a file with the name reservations.txt_stats.txt. You can use the string substr method to remove the last 4 characters from the file name. Write a static function called CreateStatsFile to do this task. Choose the appropriate parameters and return type.
Option 5: Exit the Program If the user chooses this option, the program will exit. Note: If any other option (other than exit) is chosen, the task will be performed and then the menu will be displayed again.
You will hand in, through blackboard, a zip file containing your javadocs, your java files as well as the statistics file and a screen shot of running your program using the following sequence of steps: 1. (20 points) Option 1 to add customers from reservations.txt provided with this project 2. (10 points) Option 4 to view reservations 3. (10 points) Option 2 to add a new reservation 4. (10 points) Option 2 to add a new reservation 5. (10 points) Option 4 to view reservations confirm the 2 reservations you added are there 6. (20 points) Option 3 to update a reservation 7. (10 points) Option 4 to view reservations confirm the update happened correctly 8. (10 points) Option 5 to find a reservation that exists 9. (10 points) Option 5 to find a reservation that does not exist 10.(40 points) Option 6 to download the statistics file 11. (10 points) Option 7 to exit
text file Bob Mike 200 23 B Matt Benjamin 178 15 A Keller Helen 135.99 6 D Tim Mary 210.77 12 E James Alan 133.12 1 C William Carla 133.12 1 D Mathew Robin 200 23 A Jacob Tom 154.11 15 C Nathan Norman 191.22 13 B Nick Nate 133.11 13 C Ethan Mary 177.11 12 C Kate Helen 200 20 B Benjamin Alan 112.43 20 A John Jamie 200.11 20 C Bob Annie 123.13 20 E
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
