A movie theater only keeps a percentage of the revenue earned from ticket sales. The remainder goes to the movie distributor. Write a program that calculates a theater’s gross and net box office profit for a night. The program should ask for the name of the movie, and how many adult and child tickets were sold and the price of adult and price of the child ticket. It should display a report similar to:
Movie Name: |
“Wheels of Fury” |
Adult Tickets Sold: |
|
Child Tickets Sold: |
|
Price of Adult Ticket |
|
Price of Child Ticket |
|
Gross Box Office Profit: |
|
Net Box Office Profit: |
|
Amount Paid to Distributor: |
Assume the theater keeps 20 percent of the gross box office profit.
SOURCE CODE:
*Please follow the comments to better understand the code.
**Please look at the Screenshot below and use this code to copy-paste.
***The code in the below screenshot is neatly indented for better understanding.
This is a very big question.
I have solved all of them.
Please give me an upvote dear, Much Appreciated.!!
#include<iostream>
#include<iomanip>
#include<string>
using namespace std;
int main()
{
// declare the variables here
string movieName;
double at, ct, gb, nb, cut;
// initialise the adult price and child price.
double a = 6.00, c = 3.00;
cout << "Enter the name of the movie: ";
getline(cin, movieName);
cout << "Enter number of adult tickets sold: ";
cin >> at;
cout << "Enter number of child tickets sold: ";
cin >> ct;
gb = (at * a) + (ct * c);
//Theather keeps 20% of the box office profit
nb = gb * 0.20;
cut = gb - nb;
//left to left justify, setw(30) to set the number of spaces in
first column
//right to right justify again, setw(20) followed by " or $, which
will be printed at the right (justified)
cout << left << setw(30) << "Movie Name:"
<< right << setw(20) << '"' << movieName
<< '"' << endl;
cout << left << setw(30) << "Adult Tickets Sold:"
<< right << setw(20) << " " << setw(5)
<< at << endl;
cout << left << setw(30) << "Child Tickets Sold:"
<< right << setw(20) << " " << setw(5)
<< ct << endl;
cout << setprecision(2) << fixed;
//setw(8) << gb is to specify the number of spaces used to
print and align the values
cout << left << setw(30) << "Gross Box Office
Profit:" << right << setw(20) << "$" <<
setw(8) << gb << endl;
cout << left << setw(30) << "Net Box Office
Profit:" << right << setw(20) << "$" <<
setw(8) << nb << endl;
cout << left << setw(30) << "Amount Paid to
Distributor:" << right << setw(20) << "$"
<< setw(8) << cut << endl << endl;
return 0;
}
Get Answers For Free
Most questions answered within 1 hours.