In: Computer Science
•A theater owner agrees to donate a portion of gross ticket sales to a charity
•The program will prompt the user to input:
−Movie name
−Adult ticket price
−Child ticket price
−Number of adult tickets sold
−Number of child tickets sold
−Percentage of gross amount to be donated
•Inputs: movie name, adult and child ticket price, # adult and child tickets sold, and percentage of the gross to be donated
•The program needs to:
1.Get the movie name
2.Get the price of an adult ticket price
3.Get the price of a child ticket price
4.Get the number of adult tickets sold
5.Get the number of child tickets sold
Below is commented program code solution for your problem.
#include<iostream>
using namespace std;
int main()
{
string Movie_name;
// Declare all variables
int Adult_ticket_price, Child_ticket_price;
int Number_of_adult_tickets_sold;
int Number_of_child_tickets_sold;
int Percentage_of_gross_amount_to_be_donated;
// Take input from user
cin >> Movie_name;
cin >> Adult_ticket_price;
cin >> Child_ticket_price;
cin >> Number_of_adult_tickets_sold;
cin >> Number_of_child_tickets_sold;
cin >> Percentage_of_gross_amount_to_be_donated;
// Get input and print result
cout << "movie name = " << Movie_name <<
"\n";
cout << "price of an adult ticket price = " <<
Adult_ticket_price << "\n";
cout << "price of a child ticket price = " <<
Child_ticket_price << "\n";
cout << "number of adult tickets sold = " <<
Number_of_adult_tickets_sold << "\n";
cout << "number of child tickets sold = " <<
Number_of_child_tickets_sold << "\n";
return 0;
}
I have also provided a image of code below along with the
output.