Airplane Seating Assignment: Write a program that can be used to assign seats fo
ID: 3622101 • Letter: A
Question
Airplane Seating Assignment: Write a program that can be used to assign seats for a commercial airplane. The airplane has 13 rows, with 6 seats in each row. Rows 1 and 2 are first class, rows 3 to 7 are business class, and rows 8 to 13 are economy class. Your program prompts the user to enter the following information:a) Ticket type (first class, business class, or economy class)
b) Desired seat
Output the seating plan in the following format:
A B C D E F
Row 1 * * X * X X
Row 2 * X * X * X
Row 3 * * X X * X
Row 4 X * X * X X
Row 5 * X * X * *
Row 6 * X * * * X
Row 7 X * * * X X
Row 8 * X * X X *
Row 9 * * X * X X
Row 10 * X * X X X
Row 11 * * X * X *
Row 12 * * X X * X
Row 13 * * * * X *
Here, * indicates that the seat is available; x indicates that the seat has been assigned. Make this a menu driven program; show the user's choices and allow the user to make the appropriate choices.
Explanation / Answer
Hope this helps. Let me know if you have any questions. Please rate. :) import java.util.Scanner; public class Airplanes { public static final int NUM_ROWS = 13; public static final int SEATS_PER_ROW = 6; public static char[][] seats = new char[NUM_ROWS][SEATS_PER_ROW]; /** * Initializes all seats to empty (*) */ public static void initializeSeats() { for (int i = 0; iRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.