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
PLEASE USE C++
C++ code:
#include<iostream>
#include<string>
using namespace std;
int main()
{
// variable intialization to store data
string movie;
float adultTicketPrice, childTicketPrice, percentageDonated,
amountDonated;
int adultTickets, childTickets;
// get data
cout<<"Enter movie name: ";
getline(cin, movie);
cout<<"Adult ticket price: ";
cin>>adultTicketPrice;
cout<<"Child ticket price: ";
cin>>childTicketPrice;
cout<<"Number of adult tickets sold: ";
cin>>adultTickets;
cout<<"Number of adult tickets sold: ";
cin>>childTickets;
cout<<"Percentage of gross amount to be donated:
";
cin>>percentageDonated;
// callculate amount to be donated
float totalAmount = ((adultTicketPrice * adultTickets)
+ (childTicketPrice * childTickets));
amountDonated =
(totalAmount*percentageDonated)/100;
// print amount
cout<<endl<<"Total amount to bedonated:
"<<amountDonated<<endl;
}
Output :
Enter movie name: xyz
Adult ticket price: 100
Child ticket price: 60
Number of adult tickets sold: 200
Number of adult tickets sold: 25
Percentage of gross amount to be donated: 20
Total amount to bedonated: 4300
Hope you like it
Any Query? Comment Down!
I have written for you, Please up vote the answer as it encourage us to serve you Best !
Get Answers For Free
Most questions answered within 1 hours.