Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me fix this Java project. I try in to print out selected seat as a table below .I'm using Eclipse. Thanks class AirPlaneSeatReservation

Please help me fix this Java project. I try in to print out selected seat as a table below .I'm using Eclipse. Thanks

image text in transcribedclass AirPlaneSeatReservation { public static void main(String args[]) { //Seating array String[][] seats = new String[13][6]; int i, j, userCh, seatCh, row, col; //Initializing array for(i=0; i2) { System.out.printf(" Error!!! Invalid seat for this class "); } else { //Checking for availability if((seats[row-1][col-1]).equalsIgnoreCase("*")) { System.out.println(" Seat Allotted... "); seats[row-1][col-1] = "X"; } else { System.out.println(" Sorry!!! Seat already occupied... "); } } } else if(seatCh == 2) { if(row7) { System.out.printf(" Error!!! Invalid seat for this class "); } else { //Checking for availability if((seats[row-1][col-1]).equalsIgnoreCase("*")) { System.out.println(" Seat Allotted... "); seats[row-1][col-1] = "X"; } else { System.out.println(" Sorry!!! Seat already occupied... "); } } } else if(seatCh == 3) { if(row13) { System.out.printf(" Error!!! Invalid seat for this class "); } else { //Checking for availability if((seats[row-1][col-1]).equalsIgnoreCase("*")) { System.out.println(" Seat Allotted... "); seats[row-1][col-1] = "X"; } else { System.out.println(" Sorry!!! Seat already occupied... "); } } } } else if(userCh == 2) { display(seats); } else { return; } } } //Method that prints the seating arrangement public static void display(String[][] seats) { //Printing header System.out.printf(" %-14s %-5s %-5s %-5s %-10s %-5s %-5s %-5s ", " ", "A", "B", "C", " ", "D", "E", "F"); //Iterating over rows for(int i=0; i 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: 1. Ticket type (first class, business class, or economy class) 2. Desired seat Output the seating plan in the following format: A B C Row 1 *X Row 2 *X Row 3 *X Row 4 XX Row 5 *X* Row 6 *X Row 7 X** Row 8 *X* Row9 X* X Row 10X* Row 11*X Row 12X Row 13 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, until the user is ready to quit

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems An Application Oriented Approach Complete Version

Authors: Michael Kifer, Arthur Bernstein, Richard Lewis

2nd Edition

0321268458, 978-0321268457

More Books

Students also viewed these Databases questions

Question

A 300N F 30% d 2 m Answered: 1 week ago

Answered: 1 week ago

Question

Perform an Internet search. Discuss a company that uses EPLI.

Answered: 1 week ago

Question

How do you feel about employment-at-will policies? Are they fair?

Answered: 1 week ago