answer.
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]
1 year 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]1 year 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
A time-saving strategy that helps define unfamiliar words involves using
yuradex [85]

The correct answer is A. Familiar words for clues

Explanation:

Finding unfamiliar words is common while reading, especially in texts that belong to a specific field such as medicine, technology, etc. This can be handled through multiple strategies such as using a dictionary, guessing the meaning of the word based on its parts, and using context clues.

In this context, one of the easiest and most time-saving strategy is the use of context clues that implies using the familiar words as clues to guess the meaning of an unfamiliar word. This is effective because in most cases the meaning of an unknown word can be determined using the context of the word or words around the unknown word. Also, this strategy takes little time because you only need to analyze the sentence or paragraph where the unknown word is. Thus, the time-saving strategy to define unfamiliar words involves using familiar words for clues.

6 0
1 year ago
Read 2 more answers
Select the correct answer. Richard owns a chain of hardware stores. He wants to update the store website and write a numbered li
olga_2 [115]
What’s the answer choices ?
3 0
2 years ago
Bill needs to make a presentation in which he has to represent data in the form of a pyramid. Which feature or menu option of a
andreyandreev [35.5K]

Answer:If you need to use arrows in a chart, which feature or menu option of a word processing program would you use?

A.  

Picture

B.  

Shapes

C.  

Clip Art

D.  

SmartArt

E.  

Charts

Explanation:

7 0
2 years ago
You are an ISP. For the Address Block 195.200.0.0/16 a. If you have 320 Customers that need 128 addresses/customer - will there
12345 [234]

Answer:

a. The network will not satisfy the customers because the required addresses is 128 but what can be offered is 126.

b. 195.200.0.0/22

Explanation:

195.200.0.0/16

The number of bits to give 512 is 9

2^9=512

2^8=256 which is not up to our expected 320 customers that requires a network ip

Note we have to use a bit number that is equal or higher than our required number of networks.

The number of host per each subnet of the network (195.200.0.0/25) is (2^7)-2= 128-2=126

The network will not satisfy the customers because the required addresses is 128 but what can be offered is 126.

b. 64 customers requires  6 bits to be taken from the host bit to the network bit

i.e 2^6 = 64

195.200.0.0/22

The number of host per each subnet of the network (195.200.0.0/22) is (2^10)-2=1024 - 2 = 1022 hosts per subnet

This network meet the requirement " 64 customers want 128 addresses/customer "

5 0
1 year ago
In cell F29, use an IF function to display the correct Shipping Charge, based on the amount of the Discounted Total. If the Disc
sladkih [1.3K]

Answer:

= IF(B29 >= B28,0,(0.05 * B29))

Explanation:

Given

Free Shipping Minimum = B28

Shipping Charge = F29

Required

Write a formula in F29 to calculate the total shipping charge based on the condition in the question.

To solve this, the following assumption needs to be made.

It'll be assumed that cell B29 contains the value for Discounted Total.

So,

Discounted Total = B29

The condition in the question says

1. If Discounted Total (B29) is greater than or equal to the Free Shipping Minimum (B29), then Shipping Charge (F29) is 0

This can be represented as

If(B29 >= B28)

F29 = 0

2. Else (i.e. if (1) above is false), Shipping Charge (F29) equals 5% of Discounted Total (B29)

This can also be represented as

F29 = 0.05 * B29

Writing the formula in (1) and (2) together in Excel format;

= IF(B29 >= B28, 0, (0.05 * B29))

The above formula will give the desired result based on the condition in the question.

Take for instance;

Free Shipping Minimum = B28 = 28

Discounted Total = B29 = 30

Since 30 >= 28, the value of F29 will be 0 because it satisfies condition 1.

But if

Free Shipping Minimum = B28 = 30

Discounted Total = B29 = 28

Since 28 < 30, the value of F29 will be 5% of 28 = 1.4 because it satisfies condition 2

8 0
1 year ago
Other questions:
  • When creating a table in the relational database design from an entity in the extended e-r model, the attributes of the entity b
    13·1 answer
  • there are four stage of the product life cycle. during which of these stages do you think is the best time for a company to purc
    10·2 answers
  • Given a int variable named yesCount and another int variable named noCount and an int variable named response write the necessar
    14·1 answer
  • The following checksum formula is widely used by banks and credit card companies to validate legal account numbers: d0 + f(d1) +
    13·1 answer
  • dam is writing a program that: 1) has the user guess a number, and 2) tells the user how many guesses it took to get the correct
    9·1 answer
  • (Package Inheritance Hierarchy) Package-delivery services, such as FedEx®, DHL® and UPS®, offer a number of different shipping o
    10·1 answer
  • You would like the user of a program to enter a customer’s last name. Write a statement thaUse the variables k, d, and s so that
    5·1 answer
  • PLEASE HELP!!!
    11·1 answer
  • A school has 100 lockers and 100 students. All lockers are closed on the first day of school. As the students enter, the first s
    10·1 answer
  • A drive is small enough to be carried in one's pocket.
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!