Question: Implement an Auditorium class with static data member total_seats and a parameterized non static method seatBooking. The total_seats is initialized to 20. The seatBooking method
Implement an Auditorium class with static data member total_seats and a parameterized non static method seatBooking. The total_seats is initialized to 20. The seatBooking method takes the number of seats to be booked as an argument, and it checks whether sufficient seats are available or not. For if sufficient seats are available, the requested seats are deducted from total_seats else message is given insufficient seats. Create an object of Auditorium and run the seatBooking method in continuous while loop unit all the seats are booked. The number of seats to be booked in any instance is taken as user input. The sample output is given bellow: Total Seats: 20 Number of seats to be booked: 5 5 seats are booked successfully Total Seats: 15 Number of seats to be booked: 4 4 seats are booked successfully Total Seats: 11 Number of seats to be booked: 6 6 seats are booked successfully Total Seats: 5 Number of seats to be booked: 6 Insufficient seats Total Seats: 5 Number of seats to be booked: 3 3 seats are booked successfully
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
