menu
bartleby
search
close search
Hit Return to see all results

this is a problem that I have how would I go about solving it?Stadium Seating There are three seating categories for a BC 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 display the total number of tickets sold, the amount of income generated from each class and the total ticket sales. Note: Use constants for the seat prices. Sample output: WELCOME TO THE BROWARD COLLEGE STADIUM!! Please enter the number of Class A seats sold: 100 Please enter the number of Class B seats sold: 200 Please enter the number of Class C seats sold: 150 ************************************************** Total number of tickets sold: 450 Income Generated:Class A:$1500.00Class B: $2400.00Class C: $1350.00Total: $5250.00

Question

this is a problem that I have how would I go about solving it?

Stadium Seating
There are three seating categories for a BC 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 display the total number of tickets sold, the amount of income generated from each class and the total ticket sales.
Note: Use constants for the seat prices.
Sample output:
WELCOME TO THE BROWARD COLLEGE STADIUM!!
Please enter the number of Class A seats sold: 100
Please enter the number of Class B seats sold: 200
Please enter the number of Class C seats sold: 150
**************************************************
Total number of tickets sold: 450
Income Generated:

Class A:$1500.00

Class B: $2400.00

Class C: $1350.00

Total: $5250.00

check_circleAnswer
Step 1

Algorithm:

 

  • Include required header files.
  • Define main function.
    • Initializes the seat prices for class A, B and C.
    • Declare required variables.
    • Display message statement.
    • Display prompt statement for class A seats sold.
    • Read the number of class A seats from user.
    • Display prompt statement for class B seats sold.
    • Read the number of class b seats from user.
    • Display prompt statement for class C seats sold.
    • Read the number of class C seats from user.
    • Compute the total number of tickets sold.
    • Display the amount in 2 decimal point using “setprecision”.
    • Compute the amount of income generated from class A, class B and class C.
    • Compute the sales of total tickets.
    • Display the amount of income generated from each class.
    • Display total sales amount.
Step 2

Note: The given program has been compiled and executed in "repl.it" online complier.

Program:

 

//Include necessary header files
#include <iostream>
#include<iomanip>
using namespace std;

//Define main function
int main()
{
//Initializes the seat prices for class A, B and C
constdouble cost_classA = 15, cost_classB = 12, cost_classC = 9;

//Declare required variables
double classA_seats, classB_seats, classC_seats, total_soldTickets;
double classA_income, classB_income, classC_income, totalTicketSales;
  
  //Display message statement
  cout << "WELCOME TO THE BROWARD COLLEGE STADIUM!!\n";

//Display prompt statement for class A seats sold
cout << "Please enter the number of Class A seats sold: ";

//Read the number of class A seats from user
  cin >> classA_seats;

//Display prompt statement for class B seats sold
  cout << "Please enter the number of Class B seats sold: ";

//Read the number of class B seats from user
  cin >> classB_seats;

//Display prompt statement for class C seats sold
  cout << "Please enter the number of Class C seats sold: ";

//Read the number of class C seats from user
  cin >> classC_seats;
  
//Display statement
cout << "**************************************************\n";

  //Compute the total number of tickets sold
  total_soldTickets = classA_seats + classB_seats + classC_seats;
  
//Display the total number of sold tickets
cout << "Total number of tickets sold: " << total_soldTickets << endl;

//Display message statement
cout << "Income Generated:" << endl;

//Display the amount in 2 decimal point using "setprecision"
cout << setprecision(2) << fixed;

//Compute the amount of income generated from class A
  classA_income = classA_seats * cost_classA;

//Compute the amount of income generated from class B
classB_income = classB_seats * cost_classB;

//Compute the amount of income generated from class C
classC_income = classC_seats * cost_classC;

//Compute the sales of total tickets
total_soldTickets = classA_income + classB_income + classC_income;

//Display the amount of income generated from each class
cout << "\nClass A: $" << classA_income << endl;
cout << "\nClass B: $" << classB_income << endl;
cout << "\nClass C: $" << classC_income << endl;

//Display total sales amount
cout << "\nTotal: $" << total_soldTickets << endl;
 
  return 0;   
}
 
Step 3

Screenshot of code 1:...

fullscreen

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Our solutions are written by experts, many with advanced degrees, and available 24/7

See Solution
Tagged in

Engineering

Computer Engineering

Programing

Related Computer Engineering Q&A

Find answers to questions asked by student like you

Show more Q&A add
question_answer

Q: Based on Program.Py below, define and describe a soft process (using a process model), which you wil...

A: Solution:Process model:The software process contains the four activities such as software specificat...

question_answer

Q: How Technology can help to develop more effective policy?  (Information technology in Global Economy...

A: Information technology:Information technology(IT) has become a very important part of every business...

question_answer

Q: Hello, How to create a function in Python that strips the first letters from all file names in a dir...

A: The given program can be implemented using following instructions:In the function StripFirstLetter()...

question_answer

Q: Multiple industries are considering the conversion of existing vehicles to autonomously operated veh...

A: Solution:Multiple industries are considering the conversion of existing vehicles to autonomously ope...

question_answer

Q: Imagine you’d like a contractor to build a software application for you that operates like Windows C...

A: Since there are multiple questions and no specification as to which question needs to be solved, her...

question_answer

Q: For this program you need to use Eclipse. Carefully read the instructions and write a program that r...

A: The program has the following algorithm: In the main method do the following operations,Get the empl...

question_answer

Q: Assume the following declarations and initializations (MIN, MAX, num) are made just before each sub-...

A: 1. Program plan:Define the class.Define the “main()” function.Initialize the necessary variables.The...

question_answer

Q: What is the new sematic elements in HTML5? 111 <mark iv a. i and iv b. iand iii c. i, ii and iv d....

A: Out of the given options, the semantic elements of HTML5 are&lt;details&gt;&lt;nav&gt;&lt;mark&gt;He...

question_answer

Q: 1.1 Show that the following sets satisfy the law of contradiction and law ofexcluded middle.X = {a, ...

A: The conditions for to satisfy the law of contradiction and the law of excluded middle are:

Sorry about that. What wasn’t helpful?