Java Program 01 - Theater Ticket System A small ten-seat theater has contracted you to build software which will reserve tickets. The theater has two rows of five seats each. Each row is referred to by number (1 or 2) and each seat in the row is referred to by letter (A, B, C, D, and E). When started, the program should ask the user for the row they prefer (row selection). If that row has no empty seats then the program should ask the user if they prefer the other row, if no then display a message stating the next show is tomorrow. Upon selecting a row, the program should present the user with a choice of available seats in the row. The user can then either choose a seat and print the ticket (in this case a simple message will suffice) or return to row selection. If a ticket is printed the program should return to row selection. The program terminates when all seats are reserved. Please enter a row: 1 Available seats: A B C D E Which seat, enter Q for none?: B You have booked seat: 1B Please enter a row: 1 Available seats: A C D E Which seat, enter Q for none?: C You have booked seat: 1C Please enter a row: 2 Available seats: A B C D E Which seat, enter Q for none?: A You have booked seat: 2A Please enter a row: 1 Available seats: A D E Which seat, enter Q for none?: D You have booked seat: 1D Please enter a row: 1 Available seats: A E Which seat, enter Q for none?: E You have booked seat: 1E Please enter a row: 1 Available seats: A Is this seat acceptable (Y/N)?: N Please enter a row: 1 Available seats: A Is this seat acceptable (Y/N)?: Y You have booked seat: 1A Please enter a row: 1 This row is full, would you like the other one (Y/N)?: N Next show is tomorrow. Please enter a row: 1 This row is full, would you like the other one (Y/N)?: Y Available seats: B C D E Which seat, enter Q for none?: Q Please enter a row: 2 Available seats: B C D E Which seat, enter Q for none?: B You have booked seat: 2B Please enter a row: 2 Available seats: C D E Which seat, enter Q for none?: C You have booked seat: 2C Please enter a row: 2 Available seats: D E Which seat, enter Q for none?: D You have booked seat: 2D Please enter a row: 2 Available seats: E Is this seat acceptable (Y/N)?: Y You have booked seat: 2E
Java Program
01 - Theater Ticket System
A small ten-seat theater has contracted you to build software which will reserve tickets. The theater has two rows of five seats each. Each row is referred to by number (1 or 2) and each seat in the row is referred to by letter (A, B, C, D, and E). When started, the program should ask the user for the row they prefer (row selection). If that row has no empty seats then the program should ask the user if they prefer the other row, if no then display a message stating the next show is tomorrow. Upon selecting a row, the program should present the user with a choice of available seats in the row. The user can then either choose a seat and print the ticket (in this case a simple message will suffice) or return to row selection. If a ticket is printed the program should return to row selection. The program terminates when all seats are reserved.
Please enter a row: 1
Available seats: A B C D E
Which seat, enter Q for none?: B
You have booked seat: 1B
Please enter a row: 1
Available seats: A C D E
Which seat, enter Q for none?: C
You have booked seat: 1C
Please enter a row: 2
Available seats: A B C D E
Which seat, enter Q for none?: A
You have booked seat: 2A
Please enter a row: 1
Available seats: A D E
Which seat, enter Q for none?: D
You have booked seat: 1D
Please enter a row: 1
Available seats: A E
Which seat, enter Q for none?: E
You have booked seat: 1E
Please enter a row: 1
Available seats: A
Is this seat acceptable (Y/N)?: N
Please enter a row: 1
Available seats: A
Is this seat acceptable (Y/N)?: Y
You have booked seat: 1A
Please enter a row: 1
This row is full, would you like the other one (Y/N)?: N
Next show is tomorrow.
Please enter a row: 1
This row is full, would you like the other one (Y/N)?: Y
Available seats: B C D E
Which seat, enter Q for none?: Q
Please enter a row: 2
Available seats: B C D E
Which seat, enter Q for none?: B
You have booked seat: 2B
Please enter a row: 2
Available seats: C D E
Which seat, enter Q for none?: C
You have booked seat: 2C
Please enter a row: 2
Available seats: D E
Which seat, enter Q for none?: D
You have booked seat: 2D
Please enter a row: 2
Available seats: E
Is this seat acceptable (Y/N)?: Y
You have booked seat: 2E
Trending now
This is a popular solution!
Step by step
Solved in 2 steps