Starting from:

$20

Java - Airplane Seats - 2D Array

Problem #4. (2-D ARRAY) We have an airplane that has seven rows and four seats per row. Have the program display the seat patterns shown below and an X for those that have been already chosen. Loop to ask the customer what seat they would like. If that seat is not taken, print an X on it (it now is occupied). If it is already taken, indicate this to the customer. Continue until the user indicates that they are done with some type of sentinel. (For a similar program, you will find a program named GradeExam in the 2_d_array package of our NetBeans zip file). There is also a MultiDArrays.doc document in our module that describes multi-dimensional arrays. 1 A B C D After a few seats have been assigned, the pattern has an X for all occupied seats. An example is shown at the right. 1 A B C D 2 A B C D 2 A B X D 3 A B C D 3 X B X D 4 A B C D 4 A B C D 5 A B C D 5 A B C D 6 A B C D 6 A X C D 7 A B C D 7 A B C D Sample Output *Isle Seating Chart* ____________________ --- S-1 S-2 S-3 S-4 R1 A B C D R2 A B C D R3 A B C D R4 A B C D R5 A B C D R6 A B C D R7 A B C D (V)iew Seats, (P)urchase Seats, (E)xit :P *Isle Seating Chart* ____________________ --- S-1 S-2 S-3 S-4 R1 A B C D R2 A B C D R3 A B C D R4 A B C D R5 A B C D R6 A B C D R7 A B C D Please select you available seating. What Row(1-7) do you want?: 2 What Seat(1-4) do you want?: 4 *Isle Seating Chart* ____________________ --- S-1 S-2 S-3 S-4 R1 A B C D R2 A B C X R3 A B C D R4 A B C D R5 A B C D R6 A B C D R7 A B C D You just purchased a seat located at Row-2 / Seat-4 . Thank you. (V)iew Seats, (P)urchase Seats, (E)xit :V *Isle Seating Chart* ____________________ --- S-1 S-2 S-3 S-4 R1 A B C D R2 A B C X R3 A B C D R4 A B C D R5 A B C D R6 A B C D R7 A B C D (V)iew Seats, (P)urchase Seats, (E)xit :P *Isle Seating Chart* ____________________ --- S-1 S-2 S-3 S-4 R1 A B C D R2 A B C X R3 A B C D R4 A B C D R5 A B C D R6 A B C D R7 A B C D Please select you available seating. What Row(1-7) do you want?: 8 invalid input, start over.. (V)iew Seats, (P)urchase Seats, (E)xit :P *Isle Seating Chart* ____________________ --- S-1 S-2 S-3 S-4 R1 A B C D R2 A B C X R3 A B C D R4 A B C D R5 A B C D R6 A B C D R7 A B C D Please select you available seating. What Row(1-7) do you want?: 6 What Seat(1-4) do you want?: 5 invalid input, start over.. (V)iew Seats, (P)urchase Seats, (E)xit :P *Isle Seating Chart* ____________________ --- S-1 S-2 S-3 S-4 R1 A B C D R2 A B C X R3 A B C D R4 A B C D R5 A B C D R6 A B C D R7 A B C D Please select you available seating. What Row(1-7) do you want?: 7 What Seat(1-4) do you want?: 3 *Isle Seating Chart* ____________________ --- S-1 S-2 S-3 S-4 R1 A B C D R2 A B C X R3 A B C D R4 A B C D R5 A B C D R6 A B C D R7 A B X D You just purchased a seat located at Row-7 / Seat-3 . Thank you. (V)iew Seats, (P)urchase Seats, (E)xit :E

More products