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

The Pepsi Center has four seating sections, the Main Concourse Level, the Upper

ID: 3910547 • Letter: T

Question

The Pepsi Center has four seating sections, the Main Concourse Level, the Upper Concourse Level, Suites, and Disabled seating. The Pepsi Center charges the following price for tickets in each section: the main section seat costs $130 each, the upper section seats cost $75 each, suites cost $5,000 each, and the disabled section costs $55 each. The Pepsi Center has 18,118 seats available for its Denver Nuggets games. There are 8,650 in seats in the main section, 7,650 seats in the upper section, 298 seats in the disabled section, and 95 suites that can hold up to 16 people.

Instruction

Design a program that asks for the number of tickets sold in each section and then display the amount of income generated from ticket sales. The program should validate the numbers that are entered for each section to make sure that the user has not sold more seats that a particular section can hold. Be sure to allow the user to correct their entry before continuing in the program. Your program must use the following concepts:

* Your program must use functions. The choice of what functions to write is yours. (some suggestions would: validation functions, functions for the section, display function, etc.)

* Your program must display a report that lists the section names along with the total revenue per section. Then it must display the total revenue for the game.

* You should allow the user to continue to sell tickets in all section until the program exits.

* Comment your code.

           Hint: you may want to use global counters to track the number of seats sold in ach section.

Additional requirements

* Validation menu choice by using methods instead of casting to an int.

* After the display of the program header, obtain the full name and the email address from the user. The full name must be the first name and last name of the user that is stored in a single variable.

* Create a function called splitFullname() that receives the full name of a user and returns just the first name.

* Create a function called validateEmail() that receives an email address and validates that it is in fact an email address. For now, just simply check to see if it has an @ sign and a period; regardless of position.

     Hint: One way to do this to create flags; hasAmpersand and hasPeriod and set them to false until you have confirmed that it is a valid email. If the email is invalid, prompt the user to enter a valid email address by telling them what is missing. The function should only return a valid email address.

* Above the seals report that prints out at the end of the program, display the following message that includes the output of the functions mentioned in tasks 1 and 2.

   Hello, {first name}, below is your final Pepsi Center Sales Report. A copy of this report has been sent to your email address at {email address}.

Explanation / Answer

here is your program : ----------->>>>>>>>>

#include<iostream>
#include<sstream>

using namespace std;

string splitFullName(string name){
stringstream ss;
ss<<name;
string fname;
ss>>fname;
return fname;
}

string validateEmail(){
string email;
bool hasem = false,hasp = false;
while(true){
  cin.clear();
  cout<<" Enter Your Mail : ";
  getline(cin,email);
  hasem = false;
  hasp = false;
  for(int i = 0;i<email.length();i++){
   if(email[i] == '@'){
    hasem = true;
   }
   if(email[i] == '.'){
    hasp = true;
   }
  }
  
  if(hasem && hasp){
   break;
  }else if(!hasem && !hasp){
   cout<<" Error : missing '@' and '.' ";
  }else if(!hasem){
   cout<<" Error : missing '@' ";
  }else{
   cout<<" Error : missing '.' ";
  }
}

return email;
}

int getInput(int a){
int in;
while(true){
  cout<<" Enter Number Of Seat : ";
  cin>>in;
  if(in > 1 && in <= a){
   break;
  }
  cout<<" Error : seat number out of bound ";
}

return in;
}

void getNumSeatSold(int arr[4]){
if((8650 - arr[0]) > 0){
  cout<<" Main ConCource Level : ";
  arr[0] = arr[0] + getInput(8650 - arr[0]);
}
if((7650 - arr[1]) > 0){
  cout<<" Upper ConCourse Level : ";
  arr[1] = arr[1] + getInput(7650 - arr[1]);
}
if(((95*16) - arr[2]) > 0){
  cout<<" Suites Section : ";
  arr[2] = arr[2] + getInput((95*16) - arr[2]);
}
if((298 - arr[3]) > 0){
  cout<<" Disabled Section : ";
  arr[3] = arr[3] + getInput(298 - arr[3]);
}
}

void calculateCost(int arr[4],double arr1[4]){
arr1[0] = arr[0] * 130;
arr1[1] = arr[1] * 75;
arr1[3] = arr[0] * 55;
arr1[2] = (double)(arr[2]/16) * 5000.0;
}

void display(string name,string email,int arr[4],double arr1[4]){
system("cls");
double total = 0.0;
cout<<" Hello, "<<splitFullName(name)<<" , Below is your Pepsi Center Sales Report : ";
cout<<" Name of Section             Number Of Seat Sold                Total Revenue ";
cout<<" Main Section                    "<<arr[0]<<"                        ";printf("$%0.2f",arr1[0]);
cout<<" Upper Section                    "<<arr[1]<<"                        ";printf("$%0.2f",arr1[1]);
cout<<" Disabled Section                    "<<arr[3]<<"                        ";printf("$%0.2f",arr1[3]);
cout<<" Suite Section                    "<<arr[2]<<"                        ";printf("$%0.2f",arr1[2]);
cout<<" Total Revenue : ";printf("$%0.2lf",arr1[0]+arr1[1]+arr1[2]+arr1[3]);
cout<<" A copy Of this Report is sent to your Email : "<<email<<" ";
}

string getName(){
string name;
cin.clear();
cout<<" Enter Your Full Name : ";
getline(cin,name);
cin.clear();
return name;
}


int main(){
string name;
string email;
int arr[4] = {0};
double arr1[4] = {0.0};
cout<<" ============================ WELCOME TO PEPSI SALE REPORT SERVICE ================================";
name = getName();
email = validateEmail();
char ch;
while(true){
  getNumSeatSold(arr);
  calculateCost(arr,arr1);
  if(arr[0] < 8650 || arr[1] < 7650 || arr[2] < (95*16) || arr[3] < 298){
   cin.clear();
   cout<<" Do You Want to Sell More Seat : (y/n) ";
   cin>>ch;
   if(ch == 'n' || ch == 'N'){
    break;
   }
  }else{
   break;
  }
}

display(name,email,arr,arr1);
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