Question

There are three seating categories at a stadium. For a softball game, Class A seats cost...

There are three seating categories at a stadium. For a 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 displays the amount of income generated from ticket sales. Format your dollar amount in fixed-point notation, with two decimal places of precision, and be sure the decimal point is always displayed.


Using the following test data:
1 2 3

Your output should look like this:
Enter the number of Class A tickets sold: Enter the number of Class B tickets sold: Enter the number of Class C tickets sold:
Total income from sale of tickets is $66.00

This is C++ and use visual studio 2017 please.

Use blank lines to separate the major parts of your main function and show your output.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Source Code in C++:

#include <iostream>

using namespace std;

int main()
{
int a,b,c; //variables to hold number of ticket for each class
cout << "Enter the number of Class A tickets sold: ";
cin >> a; //taking number of class A tickets as input
if(a<0) //validating input
{
cout << "No. of tickets cannot be negative." << endl;
//error message
return 1; //terminating the program
}
cout << "Enter the number of Class B tickets sold: ";
cin >> b; //taking number of class B tickets as input
if(b<0) //validating input
{
cout << "No. of tickets cannot be negative." << endl;
//error message
return 2; //terminating the program
}
cout << "Enter the number of Class C tickets sold: ";
cin >> c; //taking number of class C tickets as input
if(c<0) //validating input
{
cout << "No. of tickets cannot be negative." << endl;
//error message
return 3; //terminating the program
}
double total;
total=15.00*a+12.00*b+9.00*c; //calculating total
printf("Total income from sale of tickets is $%.2lf",total); //printing total
return 0;
}

Output:

Add a comment
Know the answer?
Add Answer to:
There are three seating categories at a stadium. For a softball game, Class A seats cost...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • There are three seating categories at a stadium. For a softball game, Class A seats cost...

    There are three seating categories at a stadium. For a 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 displays the amount of income generated from ticket sales. Format your dollar amount in a fixed-point notation with two decimal points and make sure the decimal point is always displayed. (Write for C++ code ony please)

  • Can anyone help me with this? Stadium Seating There are three seating categories at the Broward...

    Can anyone help me with this? Stadium Seating There are three seating categories at the Broward College Stadium. For a softball game, student tickets cost $9.00, senior tickets cost $12.00 and general tickets cost $15.00. 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. For the program: Create pseudocode as a .txt file....

  • In Python There are 3 seating categories at a stadium. Class A seats cost $20, class...

    In Python There are 3 seating categories at a stadium. Class A seats cost $20, class B cost $15, and class C $10. Write a program that asks how many tickets for each class of seats were sold, then displays the amount of income generated from tickets sales. This program should have main, calcIncome, and showIncome functions. Main function should get number of seats sold for each category and sent to calcIncome. calcIncome calculates income for each category, the return...

  • How would you code this in Python3? Instructions from your teacher: There are three seating categories...

    How would you code this in Python3? Instructions from your teacher: There are three seating categories at a stadium. Class A seats cost $20, Class B seats cost $15, and Class C seats cost $10. Write a program that asks how many tickets for each class of seats were sold, then displays the amount of income generated from ticket sales.

  • create Stadium Seating visual basic

    There are three seating categories at an athletic stadium. For a baseball game, Class A seats cost $15 each, Class B seats cost $12 each, and Class C seats cost $9each. Create an application that allows the user to enter the number of tickets sold for each class. The application should be able to display the amount of incomegenerated from each class of ticket sales and the total revenue generated.Use the following test data to determine if the application is...

  • Theater Seating Revenue with Input Validation

    A dramatic theater has three seating sections, and it charges the following prices for tickets in each section:Section A seats cost $20 each, section B seatscost $15 each, and section C seats cost $10 each.The theater has 300 seats in section A, 500 seats in section B, and 200 seats in section C.Design aprogram that asks for the number of tickets sold in each section and then displays the amount of income generated from ticket sales.The program should validatethe numbers...

  • 1 Stadium seating The Golden One Center is a monopoly supplier of Sacramento Kings tickets. Suppose...

    1 Stadium seating The Golden One Center is a monopoly supplier of Sacramento Kings tickets. Suppose that demand to see the Kings is given by p(Q) - into the stadium equals 1. For simplicity, assume that there are no fixed costs 1 vQ The marginal cost of letting another person . a. Write Golden One's profits in terms of Q. Simplify your answer as much as possible. (Hint: if the marginal cost is 1 and there are no fixed costs,...

  • Please help me develop executable code in C++: //The manager of a football stadium wants you...

    Please help me develop executable code in C++: //The manager of a football stadium wants you to write a program that calculates the total ticket //sales after each game. There are four types of tickets sold: box, sideline, premium, //and general admission. //After each game, the data is stored in a file in the following form: //ticketPrice numberofTicketsSold //... //Sample data are shown below: //250 5750 //100 28000 // 50 35750 // 25 18750 //The first line indicates that the...

  • A bus has 28 seats, arranged in 7 rows and 4 columns: This seating arrangement is...

    A bus has 28 seats, arranged in 7 rows and 4 columns: This seating arrangement is mapped, row-wise, to a 1D-array of size 28: 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 Implement a well-structured C program to enable a user to make and cancel seat reservations for the bus. The program uses a text-file seats.txt to store the reservation...

  • The language is C++ for visual studio express 2013 for windows create a TicketManager class and...

    The language is C++ for visual studio express 2013 for windows create a TicketManager class and a program that uses the class to sell tickets for a performance at a theater. Here are all the specs. This is an intense program, please follow all instructions carefully. -I am only creating the client program that uses the class and all it's functions -The client program is a menu-driven program that provides the user with box office options for a theater and...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT