Ask Question
23 April, 02:03

A dramatic theater has three seating sections, and it charges the following prices for tickets in each section: section A seats cost $20 each, section B seats cost $15 each, and section C seats cost $10 each. The theater has 300 seats in section A, 500 seats in section B, and 200 seats in section C. 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 numbers that are entered for each section.

+4
Answers (1)
  1. 23 April, 02:32
    0
    section_a_cost = 20 section_b_cost = 15 section_c_cost = 10 seatA = int (input ("Input number of ticket sold in Section A: ")) seatB = int (input ("Input number of ticket sold in Section B: ")) seatC = int (input ("Input number of ticket sold in Section C: ")) if (seatA 300) : print ("Input Section A must be between 0 - 300!") elif (seatB 500) : print ("Input Section B must be between 0 - 500!") elif (seatC 200) : print ("Input Section C must be between 0 - 200!") else: income = (seatA * section_a_cost) + (seatB * section_b_cost) + (seatC * section_c_cost) print ("Total income from ticket sales: $" + str (income))

    Explanation:

    The solution code is written in Python 3.

    Firstly, create three variables to hold the ticket cost for each section A, B and C (Line 1 - 3).

    Next, prompt user to input number of ticket sold in Section A, B and C (Line 5 - 7).

    Validate the input value by using if else if statement to check if the input fall within the range of maximum seat in each section (Line 9 - 14). If not, display error message. If the input pass all the validation, the program will calculate the total income from the ticket sales and display the result (Line 16 - 17).
Know the Answer?
Not Sure About the Answer?
Find an answer to your question ✅ “A dramatic theater has three seating sections, and it charges the following prices for tickets in each section: section A seats cost $20 ...” in 📘 Computers and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers