1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
garik1379 [7]
3 years ago
5

There are three seating categories at a stadium. Class A seats cost $20, Class B seats cost $15, and Class C seats cost $10. Wri

te a program that asks how many tickets for each class of seats were sold, then displays the amount of income generated from ticket sales.
Computers and Technology
1 answer:
Westkost [7]3 years ago
5 0

Answer:

Following are the program to this question:

def calculate_income(num,seat):#defining method calculate_income

   if seat=="A": #defining condition for seat a

       return num * 20 #return value

   if seat=="B": #defining condition for seat b

       return num * 15 #return value

   if seat=="C": #defining condition for seat c

       return num * 10 #return value

def show_income(a,b,c): #defining method show_Income

   sum=a+b+c # add total seats income

   print("Income for A class seats: $",a) #print value

   print("Income for B class seats: $",b) #print value

   print("Income for C class seats: $",c) #print value

   print("Total Income: $",sum) #print value

def main(): # defining main method

   a=int(input("Enter class A seats: ")) #input seats a value

   b=int(input("Enter class B seats: ")) #input seats b value

   c=int(input("Enter class C seats: ")) #input seats c value

   a_income=calculate_income(a,"A")  #call method for seat a

   b_income=calculate_income(b,"B") #call method for seat b

   c_income=calculate_income(c,"C") #call method for seat c

   show_income(a_income,b_income,c_income) # call method show_income for print all seat value

main()

Output:

Enter class A seats: 2

Enter class B seats: 3

Enter class C seats: 2

Income for A class seats: $ 40

Income for B class seats: $ 45

Income for C class seats: $ 20

Total Income: $ 105

Explanation:

The description of the above program can be described as follows:

  • In the above python program, three methods "calculate_income, show_income, and the main method" were defined.  
  • The method "calculate_income" accepts two-variable "num and seat" as the parameter, inside the method a three if block is used, that calculate all types of seat class rate and returns its value.
  • In the "show_income", we add all the seat value in the sum variable and use the print method, that prints all seat cost, and total cost.
  • In the main method, we input all seat value from user input and pass into the calculate_income method and collect all the return value, after calculating calculate_income we pass its return value into the show_income method, that prints all value.
You might be interested in
Which phrase best describes a spreadsheet?
Marrrta [24]
A Spreadsheet is a interactive computer application for organization, anaylsis and storage data in tabular form. Hope it helps!

~A.R.M.Y
8 0
3 years ago
Read 2 more answers
How many keys are on a microsoft windows standard keyboard
DiKsa [7]

There are 101 keys on a microsoft windows standard keyboard

7 0
4 years ago
Read 2 more answers
Bugs bunny personality traits
Dafna1 [17]

Answer:

As a character, Bugs Bunny is king, and he's as close to an animated culture hero as we're going to get. Think about it. He's the person you want to be — the smartest one in the room who's still effortlessly cool. He's quick-witted, funny, and even a little cruel, but only to his tormenters.

Explanation:I hope this helps!!!Plz leave a heart and a rating!!

3 0
4 years ago
Most of the international operations in a computer use hexadecimal numbering. True Or False
Natalija [7]

Answer:

True

Explanation:

The hexadecimal numbering is the most used numeric system for international operations in a computer, in our daily life we use the decimal system but for the CPU use the byte or octet as a basic unit of memory, we need more than 10 digits, and the hexadecimal system has 16, in addition, the binary system is hard to understand.

8 0
4 years ago
You are setting up a small network. The customer has decided to change his internet service provider (ISP) to EtherSpeed. The IS
salantis [7]

Home pc1 becouse it is the right one

3 0
3 years ago
Other questions:
  • "Suppose there is a class Alarm. Alarm has two class variables, code which contains a String value representing the code that de
    10·1 answer
  • Complete the statement below with the correct term.
    5·1 answer
  • Fred has to write a report on the general opinion of the influence of television on political decision-making. What internet res
    7·2 answers
  • “Bins” are the term for data files that have been edited out of digital film True/False
    7·1 answer
  • HELP
    13·1 answer
  • What is the exposition of the movie inside out
    13·2 answers
  • 3. An open source software operating system<br> TYPE THE ANSWER
    11·1 answer
  • A software team is setting an automation strategy and begins by identifying business processes that could benefit from automatio
    12·1 answer
  • _____ is confirming the significance of what another person is feeling.
    9·2 answers
  • _____is used to organize and modify the properties of the current selection.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!