Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

C++ Project For this project, you will create a program that calculates the numb

ID: 3748775 • Letter: C

Question

C++ Project

For this project, you will create a program that calculates the number of possible individual-sale tickets for the Broadway play "Hamilton" at the Richard Rodgers Theater in New York that has a maximum seating capacity of 1,319. The program is intended for The theater ticketing agents. The agent should be prompted for the number of group ticket holders and for the number of house ticket holders (reserved for the authors, producers, cast, theater owners, etc). The program should add together these two numbers and subtract them from the seating capacity, then display the total as the number of available tickets for individual sales. Finally, the program should display the percentage of tickets held by each group (group sales, reserved house ticket holders and individual sales).

Minimum Requirements:

Your program must include the following functions in c++:

Create a function that will perform these calculations:

Total Number of available tickets for individual sales

Percentage of individual sales

Percentage of group ticket sales

Percentage of reserved house ticket holders

For an extra challenge,create more than one function for this: one function to take in the numbers and another to do the calculation. You can use value parameters, reference parameters and return values as needed.

Create a function to display the results of the calculation by displaying the contents of a variable that holds the calculation results. Note that displaying the results cannot be in the same function that performs the calculation. They must be in separate functions. Use value parameters, reference parameters and return values as needed.

The main function should call each of the functions

Explanation / Answer


//Header Files

#include <iostream>
#include <iomanip>

//Constant for Maximum tickets

#define TOTAL 1319

using namespace std;

//Structure to store tickets type and for returning multiple values

struct seats
{
int group_tickets;
int house_tickets;
};

//Take input from user and return to main function

seats input()
{
seats tickets;
cout<<endl<<"Enter number of group ticket holders"<<endl;
cin>>tickets.group_tickets;
cout<<endl<<"Enter number of house ticket holders"<<endl;
cin>>tickets.house_tickets;
return(tickets);
}

//Calculate percentage of tickets

double percent(int tickets)
{
double percentage_value;
percentage_value=(double(tickets)/double(TOTAL))*100;
return(percentage_value);
}
  


//Main function
int main()
{

//Declare variables of type integer,char,struct and double type
int available_tickets;
double individual,group,house;
seats s;

//Call input function
s=input();

//Calculate available_tickets and display
available_tickets=TOTAL-(s.group_tickets+s.house_tickets);
cout<<endl<<"Available tickets for individual sales "<<available_tickets<<endl;

// Call function to Calculate ticket Percentage

individual=percent(available_tickets);
group=percent(s.group_tickets);
house=percent(s.house_tickets);

//Percentage of tickets for individual sales

cout<<endl<<"Percentage of Available tickets for individual sales "<<setprecision(4);
cout<<individual<<endl;

//Percentage of group ticket sales

cout<<endl<<"Percentage of Group tickets "<<setprecision(4);
cout<<group<<endl;

//Percentage of reserved house ticket holders

cout<<endl<<"Percentage of house tickets "<<setprecision(4);
cout<<house<<endl;

//End program

return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote