Change the program airlinedriverjava to assign passenger


Chapter 7 Two - Dimensional Array Lab

Change the program (AirlineDriver.java) to assign passenger seats in an airplane. Chesapeake Airlines is a small commuter airline with seats for 20 passengers in 5 rows of 4 seats each. Here is the layout:

1 A B C D

2 A B C D

3 A B C D

4 A B C D

5 A B C D

The user enters the row (1 - 5) and the seat (A - D). The seat entry may be lowercase.

Use this code to enter the seat:

System.out.print(" Enter row and seat ");

seat = scan.nextLine();

 

r = seat.??

c = seat.??

What will you need to do to change r to a valid row entry?

What will you need to do to change the character (A, B, C, D) in the variable c to the column index in the array? Check the program example on page 347. I have included the LetterCount program in the Chapter Seven Activities.

The program checks the array to see if the seat is available. An X in the array indicates the seat is not available.

If the seat is available, assign an X to that position in the array. If it's unavailable, display a message to the passenger. Use the displaySeats method after each row/seat entry.

After some seats are assigned, the layout may look like this:

1 X B C X

2 A B C D

3 A X C X

4 A B C D

5 A B C D

Continue processing requests until the user enters -1 for seat.

Request for Solution File

Ask an Expert for Answer!!
HR Management: Change the program airlinedriverjava to assign passenger
Reference No:- TGS01161792

Expected delivery within 24 Hours