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...
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?-------------------- .
Matt's Eat 'N Run has two categories of direct labor: unskilled, which costs $20 per hour,...
Matt's Eat 'N Run has two categories of direct labor: unskilled, which costs $20 per hour, and skilled, which costs $34 per hour. Management has established standards per "equivalent friendly meal," which has been defined as a typical meal consisting of a hamburger, a drink, and french fries. Standards have been set as follows: Skilled labor 2 minutes per equivalent meal Unskilled labor 6 minutes per equivalent meal For the year, Matt’s sold 198,000 equivalent friendly meals and incurred the...
Describe at least three algorithms (python only) to determine whether an arbitrary array A[1 .. n]...
Describe at least three algorithms (python only) to determine whether an arbitrary array A[1 .. n] contains more than n/4 copies of any value. Analyze the running time complexity of all the three methods.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT