Question: PLEASE DO EVERYTHING THAT IS HERE PLEASE TAKE YOUR TIME AND DO IT. PROGRAM: Write a program that uses the Airline class (described below) to
PLEASE DO EVERYTHING THAT IS HERE PLEASE TAKE YOUR TIME AND DO IT.
PROGRAM:
Write a program that uses the Airline class (described below) to assign seats for a commercial airplane.
The airplane has 13 rows, with 6 seats in each row first row (1A, 1B, 1C, 1D, 1E, 1F) second row (2A, 2B, 2C, 2D, 2E, 2F) Rows 1 and 2 are first class, rows 3 to 13 are economy class.
Your program should create an object of the Airline class and display a menu with 5 choices:
1) Add a Reservation
2) Cancel a Reservation
3) Print Passenger Names and their Seats
4) Print the Seating Plan
5) Quit.
The menu will be displayed as long as the choice is not Quit (5).
If the choice is Add a Reservation, cancel a Reservation, Print the Passenger Names and their Seats or Print the Seating Plan, the program will call the appropriate method in the class Airline.
If the choice is Quit, the program will print the final Seating Plan and the list of passengers with their assigned seats. Print the last two in sorting order by name remember these two are parallel arrays, so they must both be sorted!
CLASS AIRLINE:
Provide the following fields:
the seating plan (a 13 by 6 array of char)
the passengers names (a string array of max 80)
the passengers seats (a string array of max 80)
the lengths of the arrays (an integer)
Provide the following methods:
A constructor that initializes all fields
A method to Add a reservation
A method to Cancel a reservation
A method to Print the passenger names and their seats
A method to Print the seating plan
A method to Print end of run information called after Quit is selected
Provide additional methods that will add modularity to your class for
example, a sorting method that can be called when you print the end of
run information, methods that convert a seat string (12C) into
integer 12(row) and integer 3(column) for the seating plan array, etc.
The method to Add a reservation should print the seating plan and ask the user to enter their name, the
ticket type (first class or economy class) and the desired seat and should update the seating plan and
the arrays that store the passengers names and seats.
Input validation: validate the desired seat.
The method to Cancel a reservation should ask the user to enter their name, and if the passenger is in the list, should delete all the information related to the passenger and update the Seating Plan. If the name is not in the passenger list, the method should print an error message.
The method to Print the passengers names and seats should print all the passengers names and their seats if there are any passenger, or the plane is empty if there are no passengers.
The method to Print end-of-run information should print the final seating plan and the list of passengers with their assigned seats in sorting order by name.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
