A dramatic theater has three seating sections, and it charges the following prices for tickets in each section:
Section A seats: $20 each
Section B seats: $15 each
Section C seats: $10 each
The number of seats in each section is as follows:
Section A: 300 seats
Section B: 500 seats
Section C: 200 seats
Design a program that asks for the number of tickets sold in each section and then displays the amount of income generated from ticket sales. The program should validate the number of seats entered for each section.
Requirements
Your program should consist of the following:
The following constants, declared globally:
MAX_A_SEATS = 300
MAX_B_SEATS = 500
MAX_C_SEATS = 200
A_SECTION_PRICE = 20
B_SECTION_PRICE = 15
C_SECTION_PRICE = 10
Module main()
Module main() should include the following:
Calls to a single function, validateSeats, three times to validate the number of seats in each section. Each of the three calls to validateSeats returns a valid number of seats assigned to variables CountASeats, CountBSeats, and CountCSeats, respectively. Each call to validateSeats should pass the section name ("A", "B", or "C") and the maximum number of seats for that section.
Function validateSeats
Asks the user to input the number of seats sold. validateSeats should use a single loop to determine if the number input is 0 or greater and less than the maximum number of seats for the section. The user is required to enter a number of seats until a valid number is entered. Once a valid number is entered, return that number to Module main(). (Hint: Use a loop with two conditions to evaluate user input: <=0 and >=maxSeats (where maxSeats is the maximum number of seats passed for each function call.))
Module calculateRevenue
Accepts validated seat counts for each section as parameters. Calculates the revenue from each section and displays the total revenue.