Question

In: Computer Science

In Python There are three seating categories at a stadium. Class A seats cost $20, Class...

In Python

There are three seating categories at a stadium. Class A seats cost $20, Class B seats cost $15, and Class C seats cost $10. Write a program that asks how many tickets for each class of seats were sold, then display the amount of income generated from ticket sales. \

your program MUST contain a main function, a calcIncome function, and a showIncome function.

  • Your main function should get the number of seats sold for each category. The values should be sent to a calcIncome function.

  • The calcIncome function should calculate the income from each category. Those values should be returned to the main function and those values should be sent to the showIncome function.

  • The showIncome function should calculate the total income generated from the ticket sales, display the income generated from each category AND display the total income generated.

Solutions

Expert Solution

CODE -

# Function to calculate income generated from selling seats of different class
def calcIncome(numClassA, numClassB, numClassC):
  
# Calculating the income generated from different class seats
incomeClassA = numClassA * 20
incomeClassB = numClassB * 15
incomeClassC = numClassC * 10
  
# Returning the incomes
return incomeClassA, incomeClassB, incomeClassC

# Function to display income generated from ticket sales
def showIncome(incomeClassA, incomeClassB, incomeClassC):
  
# Calculating the total income
totalIncome = incomeClassA + incomeClassB + incomeClassC
  
# Displaying the income generated from seats of different class and total income generated.
print("Income generated from Class A seats = ${:.2f}" .format(incomeClassA))
print("Income generated from Class B seats = ${:.2f}" .format(incomeClassB))
print("Income generated from Class C seats = ${:.2f}" .format(incomeClassC))
print("TOtal income generated = ${:.2f}" .format(totalIncome))

# Main function
def main():
  
# Taking number of seats sold of different class as input from user
numClassA = int(input("Enter the number of tickets sold for class A: "))
numClassB = int(input("Enter the number of tickets sold for class B: "))
numClassC = int(input("Enter the number of tickets sold for class C: "))
  
# Calling function to calculate income from different class seats
incomeClassA, incomeClassB, incomeClassC = calcIncome(numClassA, numClassB, numClassC)
  
# Calling function to display the income generated
showIncome(incomeClassA, incomeClassB, incomeClassC)

main()

SCREENSHOT -

If you have any doubt regarding the solution, then do comment.
Do upvote.


Related Solutions

n Python There are three seating categories at a stadium. Class A seats cost $20, Class...
n Python There are three seating categories at a stadium. Class A seats cost $20, Class B seats cost $15, and Class C seats cost $10. Write a program that asks how many tickets for each class of seats were sold, then display the amount of income generated from ticket sales. \ your program MUST contain a main function, a calcIncome function, and a showIncome function. Your main function should get the number of seats sold for each category. The...
Using Coding langues C ++ ---------------------------------------- There are three seating categories at a stadium. For a...
Using Coding langues C ++ ---------------------------------------- There are three seating categories at a stadium. For a softball game, Class A seats cost $15, Class B seats cost $12, and Class C seats cost $9. Write a program that asks how many tickets for each class of seats were sold, then displays the amount of income generated from ticket sales. Format your dollar amount in fixed-point notation, with two decimal places of precision, and be sure the decimal point is always...
A stadium designer has placed 900 seats in one section of the stadium. Assume that the...
A stadium designer has placed 900 seats in one section of the stadium. Assume that the weights of people who will occupy those seats are i.i.d. with a mean of 160 pounds and an SD of 25 pounds. Fill in the blanks with numbers and show your calculation: With chance about 99%, the total weight of people in the 900 seats will be in the range ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯± ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ pounds.
A theater has 500 seats, divided into orchestra, main, and balcony seating. Orchestra seats sell for...
A theater has 500 seats, divided into orchestra, main, and balcony seating. Orchestra seats sell for $50, main seats for $35, and balcony seats for $25. If all the seats are sold, the gross revenue to the theater is $17,100. If all the main and balcony seats are sold, but only half the orchestra seats are sold, the gross revenue is $14,600. How many balcony seats are there?
a broadway theatre has 600 seats, divided into orchestra, main, and balcony seating. orchestra seats sell...
a broadway theatre has 600 seats, divided into orchestra, main, and balcony seating. orchestra seats sell for 50 main seats for 35 and balcony for 25. if all seats are sold the revenue to the threatre is 20900. if all the main and balcony seats are sold but only half the orchestra seats are sold the gross revenune is 17900 how many are there of each kind of seat
A community baseball stadium has 10 seats in the first row, 13 seats in the second row, 16 seats in the third row, and ...
A community baseball stadium has 10 seats in the first row, 13 seats in the second row, 16 seats in the third row, and so on. There are 56 rows in all. What is the seating capacity of the stadium?
What are the three categories of psychoactive substances? This question is for a narcotics class
What are the three categories of psychoactive substances? This question is for a narcotics class
Unoccupied seats at the Cardinal’s football stadium causes the football team to lose revenue. The Cardinal’s...
Unoccupied seats at the Cardinal’s football stadium causes the football team to lose revenue. The Cardinal’s owner wants to estimate the mean number of unoccupied seats per game over the past few years. To accomplish this, the records of 225 games are randomly selected and the number of unoccupied seats is noted for each of the sampled games. The sample mean is 11.6 seats and the sample standard deviation is 4.1 seats. x-=
Unoccupied seats at the Cardinal’s football stadium causes the football team to lose revenue. The Cardinal’s...
Unoccupied seats at the Cardinal’s football stadium causes the football team to lose revenue. The Cardinal’s owner wants to estimate the mean number of unoccupied seats per game over the past few years. To accomplish this, the records of 225 games are randomly selected and the number of unoccupied seats is noted for each of the sampled games. The sample mean is 11.6 seats and the sample standard deviation is 4.1 seats. n – 1 =
If the cost object is a manufactured product, what are the three major cost categories to...
If the cost object is a manufactured product, what are the three major cost categories to accumulate? Explain each.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT