Question

In: Computer Science

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 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

The python code:

# calcIncome function that takes 3 parameters, number of tickets of
# type A,B and type C  sold and returns the revenue generated from each
def calcIncome(a, b, c):
    return (a * 20), (b * 15), (c * 10)


# showIncome function that takes 3 parameters , total income from A,B,C
# It adds all three to find the total income generated and prints the result
def showIncome(A, B, C):
    total_income = A + B + C
    print("Income generated by class A: {}".format(A))
    print("Income generated by class B: {}".format(B))
    print("Income generated by class B: {}".format(B))
    print("Total income generated: {}".format(total_income))


# Main function that takes user input and calls calcIncome to
# calculate the income and the show Income that pints the income
def main():
    A = int(input("Enter the number of seats sold of class A: "))
    B = int(input("Enter the number of seats sold of class B: "))
    C = int(input("Enter the number of seats sold of class C: "))
    incomeA, incomeB, incomeC = calcIncome(A, B, C)
    showIncome(incomeA, incomeB, incomeC)


# Calling the main function
main()

Screenshot of code for reference:

Screenshot of output:


Related Solutions

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...
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...
Real Madrid stadium requires seats for home and away end. The seating project results in $1.2...
Real Madrid stadium requires seats for home and away end. The seating project results in $1.2 MM/yr of annual savings. The seating project requires a fixed capital investment of $3.5 MM. The working capital investment is taken as 15/85 of the fixed capital investment. The annual operating cost of the stadium seating is $0.5 MM/yr. Straight-line depreciation is calculated over 10 years (no salvage value). The corporate income tax rate for the project is 35%. Assuming a discount rate of...
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
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.
A basketball team sells tickets that cost $10, $20 or, for VIP seats, $30. The team...
A basketball team sells tickets that cost $10, $20 or, for VIP seats, $30. The team has sold 3266 tickets overall. It has sold 238 more $20 tickets than $10 tickets. The total sales are $64,850. How many tickets of each kind have been sold?
A basketball team sells tickets that cost​ $10, $20,​ or, for VIP​ seats,​ $30. The team...
A basketball team sells tickets that cost​ $10, $20,​ or, for VIP​ seats,​ $30. The team has sold 33233323 tickets overall. It has sold 322322 more​ $20 tickets than​ $10 tickets. The total sales are ​$65 comma 87065,870.How many tickets of each kind have been​ sold? A. How many $10 tickets were sold? B. How many $20 tickets were sold? C. How many $30 tickets were sold?
A basketball team sells tickets that cost​ $10, $20,​ or, for VIP​ seats,​ $30. The team...
A basketball team sells tickets that cost​ $10, $20,​ or, for VIP​ seats,​ $30. The team has sold 3381 tickets overall. It has sold 209 more​ $20 tickets than​ $10 tickets. The total sales are ​$65,830. How many tickets of each kind have been​ sold? $10 tickets sold __ $20 tickets sold? __ $30 tickets sold?__
A basketball team sells tickets that cost​ $10, $20,​ or, for VIP​ seats,​ $30. The team...
A basketball team sells tickets that cost​ $10, $20,​ or, for VIP​ seats,​ $30. The team has sold 3401 tickets overall. It has sold 176 more​ $20 tickets than​ $10 tickets. The total sales are ​$66,100. How many tickets of each kind have been​ sold? How many​ $10 tickets were​ sold?---------------- How many​ $20 tickets were​ sold?-------------------- How many​ $30 tickets were​ sold?-------------------- .
Python: What are the defintions of the three method below for a class Date? class Date(object):...
Python: What are the defintions of the three method below for a class Date? class Date(object): "Represents a Calendar date"    def __init__(self, day=0, month=0, year=0): "Initialize" pass def __str__(self): "Return a printable string representing the date: m/d/y" pass    def before(self, other): "Is this date before that?"
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT