/* Program for a movie theater to calculate "The Donated" and "Total Sales" after getting following data from user: -tickets price -movie name -No. of Tickets sold -Percentage for Donation */ #include<iostream> //include "iostream" header file #include<iomanip> //include "iomanip" header file using namespace std; int main() { char movie[50]; int TotalTickets, AdultTickets, ChildTickets; float AdultTicketPrice, ChildTicketPrice, DonationPerc, Total, Donation, NetSale; cout << "Enter Movie Name (Less Than 50 Characters) : \t"; //Displays Message cin.getline(movie, 51); //Gets Movie Name cout << "Enter Adult Ticket Price : \t"; //Displays Message cin >> AdultTicketPrice; //Gets Adult Ticket Price cout << "Enter Child Ticket Price : \t"; //Displays Message cin >> ChildTicketPrice; //Gets Child Ticket Price cout << "Enter Number of Adult Tickets Sold : \t"; //Displays Message cin >> AdultTickets; //Gets Number of Adult Tickets Sold cout << "Enter Number of Child Tickets Sold : \t"; //Displays Message cin >> ChildTickets; //Gets Number of Child Tickets Sold cout << "What percentage of your Total Sales you want to donate? : \t"; cin >> DonationPerc; //Gets Percentage for Donation TotalTickets = AdultTickets + ChildTickets; //Calculates Total Number of Tickets Total = (AdultTickets*AdultTicketPrice) + (ChildTickets*ChildTicketPrice); Donation = (Total*DonationPerc) / 100; //Calculates Donation NetSale = Total - Donation; //Calculates Remaining Sales //OUTPUT Statements cout << "\n_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*_*"; cout << "\nMovie Name : ...................... " << left << movie; cout << "\nNumber of Total Tickets Sold : .... " << setw(10) << right << TotalTickets; //Displays Total Number of Tickets Sold cout << "\nGross Amount : .................. $ " << setw(10) << setprecision(2) << fixed << Total; //Displays Gross Sales cout << "\nPercentage of Gross Amount Donated: " << setw(10) << DonationPerc << "%"; //Displays Donation Percentage cout << "\nAmount Donated : ................ $ " << setw(10) << Donation; //Displays Donation cout << "\nNet Sale : ...................... $ " << setw(10) << NetSale << endl; //Displays Net Sale return 0; //return '0' }
OUTPUT
No comments:
Post a Comment