Write a program that uses the Airline class(described below) to assign seats for a commercial airplane....
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
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. The method to print the Seating Plan should output the seating plan in the following format: 1) All asterisks () if plane is empty ABC DEF ROW 1 ROW 2 *** *** * *** ROW 3 * *** ROW 4 * *** ROW 5 * ROW 6 ROW 7 * ROW 8 ROW 9 ROW 10 * ROW 11 * ROW 12 ROW 13 * * 2) X instead of* for occupied seats (here seats 2A, 6F, 9B and 13F are occupied) ABC *** DEF *** ROW 1 ROW 2 ROW 3 X** *** ROW 4 * *** ROW 5 * ROW 6 * * * X ROW 7 * *** ROW 8 * *** ROW 9 * ROW 10 ROW 11 * ROW 12 * ROW 13 * ୮ 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. The method to print the Seating Plan should output the seating plan in the following format: 1) All asterisks () if plane is empty ABC DEF ROW 1 ROW 2 *** *** * *** ROW 3 * *** ROW 4 * *** ROW 5 * ROW 6 ROW 7 * ROW 8 ROW 9 ROW 10 * ROW 11 * ROW 12 ROW 13 * * 2) X instead of* for occupied seats (here seats 2A, 6F, 9B and 13F are occupied) ABC *** DEF *** ROW 1 ROW 2 ROW 3 X** *** ROW 4 * *** ROW 5 * ROW 6 * * * X ROW 7 * *** ROW 8 * *** ROW 9 * ROW 10 ROW 11 * ROW 12 * ROW 13 * ୮
Expert Answer:
Answer rating: 100% (QA)
Heres a Python implementation of the Airline class and the program class Airline def initself selfse... View the full answer
Related Book For
Posted Date:
Students also viewed these programming questions
-
A 2-in dia. steel bar is subjected to the loading indicated. Locate and estimate the maximum shear stress in the weld throat. F T____ 2 ...... kips 15 kip ·in 6 in in 2-in dia.
-
A car website would like to test the hypothesis that the standard deviation for the age of an imported car on the road is greater than the standard deviation for the age of a domestic car. The...
-
Explain the concept of cost pool and how to determine cost pools.
-
In spring 1989, Michael Jordan and the Chicago Bulls were in Indianapolis, Indiana, to play against the Indiana Pacers. At the same time, Karla Knafel was singing with a band at a hotel in...
-
Booker Co. sold $300,000, 10%, 10-year bonds on January 1, 2014. The bonds were dated January 1, and interest is paid on January 1 and July 1. The bonds were sold at 104. Instructions (a) Prepare the...
-
Problem 4. Consider the following imperfect information game. Notice that both play- ers have two information sets. 5,2 1 a b 2 t 1 d d 4,3 6.0 4,6 0,4 6,0 (a) Find all subgame perfect Nash...
-
On July 1, 2016, Hargrove Corporation issued a 2-year note with a face value of $4,000,000 and a fixed interest rate of 9%, payable on a semiannual basis. On January 15, 2017, the company entered...
-
A piston-cylinder initially contains 10 kg of saturated liquid water at a pressure of 1000 kPa (State 1). Then, during an isobaric process, heat is transferred to the water. At the final state, the...
-
Can you please help me create a Bank reconciliation and the necessary journal entries for the below attached documents? Name: Accounting Essentials (GACG1047)- Assignment Two 1. Using the Bank...
-
1). What planning approaches and methods might GM adopt to help manage its turbulent environment and respond effectively to global economic crisis? 2). In what way does a merger solution to GM's...
-
Last year Lakeshas Lounge Furniture Corporation had an ROE of 17.5 percent and a dividend payout ratio of 20 percent. What is the sustainable growth rate? (Do not round intermediate calculations....
-
(3) (10 pts) Let C be the ellipse defined by x y + 25 4 = 1. Find the maximum value for the curvature of C.
-
You are planning a renovation project on a building that is 48 feet tall. draw a sketch showing how many HT 101 Vertical Frame sections from the attached catalogue are required to reach this height....
-
Explain the working, algorithm and time complexity of the following sorting algorithms: Odd-Even Sort / Brick Sort Cocktail Sort Strand Sort Tree Sort
-
Select a mass spectrometric technique with the highest mass resolution for identifying an unknown compound being eluted from a liquid chromatography column
-
Compute the alternating sum of all elements in an array. For example, if your program reads the input 1 4 9 16 9 7 4 9 11 then it computes 1 4 + 9 16 + 9 7 + 4 9 + 11 = 2
-
What is the advantage of a layout manager over telling the container place this component at position (x, y)?
-
Consider an interface public interface NumberFormatter { String format(int n); } Provide four classes that implement this interface. A DefaultFormatter formats an integer in the usual way. A...
-
The financial records of Dunbar Inc. were destroyed by fire at the end of 2015. Fortunately, the controller had kept the following statistical data related to the income statement. 1. The beginning...
-
Maher Inc. reported income before income tax during 2015 of 790,000. Additional transactions occurring in 2015 but not considered in the 790,000 are as follows. 1. The corporation experienced an...
-
Presented below is the trial balance of Thompson Corporation at December 31, 2015. Instructions Prepare an income statement and a retained earnings statement. Assume that the only changes in retained...
Study smarter with the SolutionInn App