Question
In Java programming, implement a theater seating chart as a two-dimensional array of ticket prices, like this: {10, 10, 10, 10, 10, 10, 10, 10,
In Java programming, implement a theater seating chart as a two-dimensional array of ticket prices, like this: {10, 10, 10, 10, 10, 10, 10, 10, 10, 10} {10, 10, 10, 10, 10, 10, 10, 10, 10, 10} {10, 10, 10, 10, 10, 10, 10, 10, 10, 10} {10, 10, 20, 20, 20, 20, 20, 20, 10, 10} {10, 10, 20, 20, 20, 20, 20, 20, 10, 10} {10, 10, 20, 20, 20, 20, 20, 20, 10, 10} {20, 20, 30, 30, 40, 40, 30, 30, 20, 20} {20, 30, 30, 40, 50, 50, 40, 30, 30, 20} {30, 40, 50, 50, 50, 50, 50, 50, 40, 30} Write a program that help users to pick either a seat or a price. Mark sold seats by changing the price to 0. Whena user species a seat, make sure it is available. When a user species a price, nd any seat with that price. Named the class as Theater and use the followings in the class: Private seatsPrices: [9][10] Public checkAvailabilityOfSeat(int x, int y): boolean Public reserveSeat (int x, int y): void Public findTheFirstAvailablePlaceAccordingToPrice(int price): int[2]
For the driver code outcome should be as below: (f there is no available seat with the given price, coordinates should be -1, -1.
Press:
1 To choose your place according to seat coordinates
2 to choose your place according to price Where do you want to sit?
1
Write coordinates please.
2
1
The place is reserved at 2.1
Is there anyone who would you like to get a ticket?(Y/N)
Y
Press:
1 To choose your place according to seat coordinates
2 To choose your place according to price
2
Please enter the price of the seat that do you want to sit.
30
The place is reserved 6,2
Is there anyone who would you like to get a ticket? (Y/N)
Y
Press:
1 To choose your place according to seat coordinates
2 to choose your place according to price
2
Please enter the price of the seat that do you want to sit.
86
The place is reserved -1,-1
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started