Airplane seating in Java Design and implement a program that assigns seats on an
ID: 3561245 • Letter: A
Question
Airplane seating in Java
Design and implement a program that assigns seats
on an airplane. Assume the airplane has 20 seats in ?rst class (5 rows of 4 seats each, separated by an aisle) and 180 seats in economy class (30 rows of 6 seats each, sepa-
rated by an aisle). Your program should take three commands: add passengers,
show seating, and quit. When passengers are added, ask for the class (?rst or econ-
omy), the number of passengers traveling together (1 or 2 in ?rst class; 1 to 3 in
economy), and the seating preference (aisle or window in ?rst class; aisle, center, or
window in economy). Then try to ?nd a match and assign the seats. If no match
exists, print a message. Follow the design process that was described in this chapter.
I need this answered in JAVA please and thank you.
Explanation / Answer
public class First_Class { int ROW = 5; //Five rows int COLUMN = 4; //Five columns private int[][] array = new int[ROW][COLUMN]; int numPassnegers; public First_Class(){ } public void addAisle(int numPassengers){ this.numPassnegers = numPassengers; for(int i =0; iRelated Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.