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
When assigned to a cell, the __________ function returns a number that corresponds to the system date and time beginning with De
Sloan [31]

Answer:

Option D: NOW

Explanation:

In Microsoft Excel, NOW function can be used to return a serial number that  corresponds to the system date and time beginning with December 31, 1899.

The NOW function is useful when a date and time is required for calculation or display. The value will be updated each time we open the Excel worksheet.  To use the NOW function, we can type in the formula as follows:

<em>=NOW() </em>

7 0
3 years ago
What is an assembler?
Flauer [41]

an assembler is a program that converts code written in a high-level language to assembly language that the computer processor can execute.

4 0
3 years ago
Which of the following is true of how packets are sent through the Internet?
astra-53 [7]

Answer:

It is A: Packet metadata is used to route and reassemble information travelling  through the internet.

Explanation:

Step 1: The Internet works by chopping data into chunks called packets. Each packet then moves through the network in a series of hops. Each packet hops to a local Internet service provider (ISP), a company that offers access to the network -- usually for a fee

Step 2: Entering the network

Each packet hops to a local Internet service provider (ISP), a company that offers access to the network -- usually for a fee.

Step 3: Taking flight

The next hop delivers the packet to a long-haul provider, one of the airlines of cyberspace that quickly carrying data across the world.

Step 4: BGP

These providers use the Border Gateway Protocol to find a route across the many individual networks that together form the Internet.

Step 5: Finding a route

This journey often takes several more hops, which are plotted out one by one as the data packet moves across the Internet.

Step 6: Bad information

For the system to work properly, the BGP information shared among routers cannot contain lies or errors that might cause a packet to go off track – or get lost altogether.

Last step: Arrival

The final hop takes a packet to the recipient, which reassembles all of the packets into a coherent message. A separate message goes back through the network confirming successful delivery.

8 0
3 years ago
Read 2 more answers
Suppose the m2 money supply is $13 trillion, including: $7 trillion in savings accounts $3 trillion in checking accounts $1 tril
tia_tia [17]

Answer:

M1 is equal to $ 4 trillion

Explanation:

M1 money supplies are liquid money supplies like cash, checkable deposits, traveler's check etc. It is equal to;

M1= coins and currency in circulation + checkable (demand) deposit + traveler's check.

M2 money supply are less liquid and is equated as;

M2 = M1 + savings deposit + money market fund + certificates of deposit + other time deposits.

Savings = $7 trillion

Checkable deposit = $3 trillion

Money market fund = $1 trillion

Currency = $1 trillion

Certificates of deposit = $1 trillion

M1 = currency + checkable deposit

= $1 + $ 3

= $4 trillion.

6 0
2 years ago
Grouping data in a report will (Points : 4) provide grand totals for your report.
zaharov [31]

Answer: Let you organize and summarize your data.

Explanation: Data grouping is referred as the making a collection or cluster of data in a report .The group is made for the summarization of the information and makes easily understandable according to the subject or field due to the proper organization.

Other given options are incorrect because it does not provide the total of the report content,attractive form of the data or editing function in report.Thus the correct option is summarizing and organizing the data.

3 0
2 years ago
Other questions:
  • What's a good show to watch on Netflix?
    7·1 answer
  • Instructions: Type the correct answer in the box. Spell the word correctly.
    5·2 answers
  • How is this fictional tex in the people could fly different from the nonfictional text​
    12·2 answers
  • A server of service is responsible for sending the contents of cengage.com to your browser when you type cengage.com into the lo
    12·1 answer
  • What is ana absolute adress
    11·1 answer
  • BADM-Provide a reflection of at least 500 words (or 2 pages double spaced) of how the knowledge, skills, or theories of this cou
    7·1 answer
  • Recommend how could you integrate positive aspects of digital literacy into your own
    13·1 answer
  • What approach do you prefer to take when creating presentations for class projects? Would you rather use software or create pres
    12·2 answers
  • Which statement about analog and digital images is true?.
    15·1 answer
  • Q3: What do you mean by a pointer to a pointer? Can this be extended?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!