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
Write a loop that fills an array int values[10] with ten random numbers between 1 and 100. Write code for two nested loops that
zalisa [80]

Answer:

#include <iostream>

#include <cstdlib>

using namespace std;

int main() {

   int[] array = new int[10];

   int index = 0;

   while(index < array.size()){

           int number = (rand() % 100) + 1;

           for (int i = 0; i < 1; i++) {

               array[index] = number;

               cout<< "Position "<< index << "of the array = "<< number << endl;

               ++index;

           }

     }

}

Explanation:

The while loop in the source code loops over a set of code ten times, The for loop only loops once to add the generated random number between 1 and 100 to the array of size 10. At the end of the for loop, the index location and the item of the array is printed out on the screen. The random number is generated from the 'rand()' function of the C++ standard library.

7 0
3 years ago
Which of these statements correctly describes how to adjust an image on a
blondinia [14]
The answer is c because they are arrow indicating to size the picture.
5 0
3 years ago
Read 2 more answers
What does foreshortening affect
AlexFokin [52]
Foreshortening is the visual effect or optical illusion that causes an object or distance to appear shorter than it actually is because it is angled toward the viewer. Additionally, an object is often not scaled evenly: a circle often appears as an ellipse and a square can appear as a trapezoid.
3 0
3 years ago
Refer to the exhibit. All workstations are configured correctly in VLAN 20. Workstations that are connected to switch SW1 are no
aleksandrvk [35]

Answer:

Allow VLAN 20 on the trunk link.

Explanation:

Enable DTP on both ends of the trunk by allowing VLAN20 on the trunk link.

From curriculum topic: 3.2.4

To Enable DTP on both switches is simply allowing the negotiation of trunking. The "Negotiation of Trunking" line in the graphic is what shows that DTP is already enabled. The graphic also shows how the native VLAN is 1, and the default VLAN for any Cisco switch is 1. The graphic shows the PCs are to be in VLAN 20.

This will remedy the problem.

8 0
3 years ago
Only now _______ why you didn't tell me.​
katrin [286]

Answer:

I understand

Explanation:

6 0
3 years ago
Read 2 more answers
Other questions:
  • You need to perform maintenance on a router and need to temporarily reroute traffic through another office. which would be the b
    6·1 answer
  • Write a program that displays in the title of the window the position of the mouse as the user moves the mouse around the window
    5·1 answer
  • What is a telecomunications system? 1) A system that enables the transmission of data over public or private networks. 2) A comm
    11·1 answer
  • Which of the following best describes a group?
    13·1 answer
  • What effect does the interconnectedness of modern media have on society?
    14·2 answers
  • A look to different section of the same page is known as_____.
    7·1 answer
  • The use of Quick Styles is a great way to save
    15·1 answer
  • Please explain this code line by line and how the values of each variable changes as you go down the code.
    8·1 answer
  • The following Python statement instructs the program to open a file for input.
    9·1 answer
  • The act of using computer equipment to “break into” the computer systems of others?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!