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

I can\'t get this to run - need help fixing it! #include #include #include #incl

ID: 3534308 • Letter: I

Question

I can't get this to run - need help fixing it! #include #include #include #include #include using namespace std; int main() { int SEAT_COUNT; int MAX_SEAT_COUNT = 25; int option; int Total_Sold = 0; int not_for_toddlers; int not_for_juniors; int not_for_adults; int TODDLERS = 0; int JUNIORS = 0; int ADULTS = 0; double price; double discount; double Gross_total = 0.0; char tmpbuf[128]; char coupon; SEAT_COUNT = MAX_SEAT_COUNT; cout << "Summerville SeaWorld Ticket Sales v1.01 "; while(SEAT_COUNT >=0 ) { cout << " Summerville SeaWorld Ticket Menu "; cout << "---------- "; cout << "1. Toddlers "; cout << "2. Juniors "; cout << "3. Adults "; cout << "4. Quit "; cout << "Enter your option "; cin >> option; switch(option) { case 1: cout << "How many tickets do you want for toddlers? "; cin >> not_for_toddlers; if(not_for_toddlers <= 10) { SEAT_COUNT = SEAT_COUNT - not_for_toddlers; cout <<" Welcome to Summerville SeaWorld "; cout <<"------------------------------- "; cout <<" The total for these tickets is $0.00 "; cout << "------------------------------------------ "; TODDLERS = TODDLERS + not_for_toddlers; Total_Sold = Total_Sold + not_for_toddlers; system("pause"); break; } else { cout <<"You are only allowed 10 tickets "; SEAT_COUNT = SEAT_COUNT - 10; cout <<" Welcome to Summerville SeaWorld "; cout <<"------------------------------- "; cout <<" The total for these tickets is $0.00 "; cout << "------------------------------------------ "; TODDLERS = TODDLERS + 10; Total_Sold = Total_Sold + 10; system("pause"); break; } case 2: cout << "How many tickets do you want for juniors? "; cin >>not_for_juniors; if(not_for_juniors <= 10) { SEAT_COUNT = SEAT_COUNT - not_for_juniors; price = not_for_juniors * 7.50; JUNIORS = JUNIORS + not_for_juniors; Total_Sold = Total_Sold + not_for_juniors; cout << " Do you have a discount coupon? (y/n) "; cin >> coupon; if('y'== coupon) { discount = price * 0.25; price = price - discount; cout.precision( 2 ); cout <<" Welcome to Summerville SeaWorld "; cout << "------------------------------------------ "; cout << "Your total discount is $"<> coupon; if('y'== coupon) { discount = price * 0.25; price = price - discount; cout.precision( 2 ); cout <<" Welcome to Summerville SeaWorld "; cout << "------------------------------------------ "; cout << "Your total discount is $"<>not_for_adults; if(not_for_adults <= 10) { SEAT_COUNT = SEAT_COUNT - not_for_adults; price = not_for_adults * 11.50; ADULTS = ADULTS + not_for_adults; Total_Sold = Total_Sold + not_for_adults; cout << "Do you have a discount coupon? (y/n) "; cin >> coupon; if('y'==coupon) { discount= price * 0.25; price = price - discount; cout.precision( 2 ); cout <<" Welcome to Summerville SeaWorld "; cout << "------------------------------------------ "; cout << "Your total discount is $"<> coupon; if('y'== coupon) { discount = price * 0.25; price = price - discount; cout.precision( 2 ); cout <<" Welcome to Summerville SeaWorld "; cout << "------------------------------------------ "; cout << "Your total discount is $"<

Explanation / Answer

work perfectly.....


#include <iostream.h>

#include<time.h>






//function prototypes

int get_ticket_type(int);

double find_ticket_price(int);

double apply_discount(double, double);

void disp_purchase(int, int, double);

void disp_final_report(int, double, int, int, int, double);









int main()





{



int SEAT_COUNT = 0;

int MAX_SEAT_COUNT = 16;

int option = 1;

int Total_Sold = 0;

int not_for_toddlers;

int not_for_juniors;

int not_for_adults;

int TODDLERS = 0;

int JUNIORS = 0;

int ADULTS = 0;

double Gross_total = 0.0;

int gtp = 0;

int nof_seat = 0;

double ftp = 0.0;

double price;

double disPrice = 0.0;

double toPrice = 0.0;







while (option != 5 && SEAT_COUNT < MAX_SEAT_COUNT)





{

gtp = get_ticket_type(option);



if(gtp==5)





{



break;





}



if(gtp==4)





{



//system("CLS");





}

ftp = find_ticket_price(gtp);



if(gtp > 1 && gtp < 4)





{



switch(gtp)





{



case 1:

cout << "How many tickets do you want for toddlers? ";





cin >> not_for_toddlers;



if(not_for_toddlers <= 10)





{

SEAT_COUNT = SEAT_COUNT - not_for_toddlers;

TODDLERS = TODDLERS + not_for_toddlers;

Total_Sold = Total_Sold + not_for_toddlers;

price = not_for_toddlers * ftp;

nof_seat = not_for_toddlers;



//system("pause");





}



else





{



cout <<"You are only allowed 10 tickets ";





SEAT_COUNT = SEAT_COUNT - 10;

TODDLERS = TODDLERS + 10;

Total_Sold = Total_Sold + 10;

price = 10 * ftp;

nof_seat = 10;



//system("pause");







}break;

case 2:

cout << "How many tickets do you want for juniors? ";





cin >>not_for_juniors;



if(not_for_juniors <= 10)





{

SEAT_COUNT = SEAT_COUNT - not_for_juniors;

JUNIORS = JUNIORS + not_for_juniors;

Total_Sold = Total_Sold + not_for_juniors;

price = not_for_juniors * ftp;

nof_seat = not_for_juniors;



//system("pause");





}



else





{



cout <<"You are only allowed 10 tickets ";





SEAT_COUNT = SEAT_COUNT - 10;

JUNIORS = JUNIORS + 10;

Total_Sold = Total_Sold + 10;

price = 10 * ftp;

nof_seat = 10;



//system("pause");

}break;

case 3:

cout << "How many tickets do you want for adults? ";





cin >>not_for_adults;



if(not_for_adults <= 10)





{

SEAT_COUNT = SEAT_COUNT - not_for_adults;

ADULTS = ADULTS + not_for_adults;

Total_Sold = Total_Sold + not_for_adults;

price = not_for_adults * ftp;

nof_seat = not_for_adults;



//system("pause");





}



else





{



cout <<"You are only allowed 10 tickets ";





SEAT_COUNT = SEAT_COUNT - 10;

ADULTS = ADULTS + 10;

Total_Sold = Total_Sold + 10;

price = 10 * ftp;

nof_seat = 10;



//system("pause");

}break;





}



disPrice = apply_discount(price, Gross_total);

disp_purchase(option, nof_seat, disPrice);

}



if (Total_Sold >= MAX_SEAT_COUNT)





{



//system("CLS");





disp_final_report(MAX_SEAT_COUNT, Total_Sold, TODDLERS, JUNIORS, ADULTS, Gross_total);



//system("pause");





}



else





{



return 0;





}

}

return 0;
}




//open get_ticket_type()







int get_ticket_type(int)





{



int option;





while(option!=5)
{

cout <<"Summerville SeaWorld Ticket Sales v1.02 ";

cout <<"-------------------------------------- ";

cout <<"Enter the following details for ticket sales: ";

cout <<"********************************************************* ";

cout << "Ticket Menu"<<endl;

cout << "----------"<<endl;

cout << "1. Toddlers"<<endl;

cout << "2. Juniors"<<endl;

cout << "3. Adults"<<endl;

cout << "4. Clear Screen"<<endl;

cout << "5. Quit"<<endl;





cin >> option;



//system("pause");







if(option>0 && option<=4 )





{



return option;

//system("pause");





}



else if(option==5)





{



return 5;

//system("pause");





}



else





{



cout << "Please enter a valid option! ";

//system("pause");





}
}


//system("pause");







}//close get_ticket_type()

double find_ticket_price(int gtp)





{



int x = gtp;

double price = 0.0;







if(x==1)





{



double price = 0.0;

return price;





}



if(x==2)





{



double price = 7.50;

return price;





}



if(x==3)





{



double price = 11.50;

return price;





}



return price;







}//close find_ticket_price

double apply_discount(double price, double Gross_total)





{



double toPrice = price;

double discountedPrice = 0.0;

double discount = 0.0;

char coupon;







cout << "Do you have a discount coupon? (y/n) "<<endl;





cin >> coupon;



if(coupon == 'y' || 'Y')





{

discount= price * 0.25;

discountedPrice = toPrice - discount;

Gross_total = Gross_total + discountedPrice;



return discountedPrice;

//system("pause");





}



else





{

Gross_total = Gross_total + price;



return toPrice;

//system("pause");





}



}//close apply_discount







void disp_purchase(int option, int nof_seat, double disPrice)





{



int y = option;

double z = disPrice;

cout <<" Welcome to Summerville SeaWorld"<<endl;

cout << "------------------------------------------"<<endl;

cout << "Ticket Details:"<<endl;

cout << "---------------"<<endl;







if(y==1)





{



cout << "Toddler Tickets"<<endl;





}



if(y==2)





{



cout << "Junior Tickets"<<endl;





}



if(y==3)





{



cout << "Adult Tickets"<<endl;





}



cout <<"The number of tickets purchased: "<<nof_seat;







if(disPrice==z)





{



cout << " Your total amount is $" <<disPrice<<endl;





}



else





{



cout << " Your total amount after discount is $" <<disPrice<<endl;





}



cout << "------------------------------------------ ";







}// close disp_purchase

void disp_final_report(int MAX_SEAT_COUNT, double Total_Sold, int TODDLERS, int JUNIORS, int ADULTS, double Gross_total)





{



char tmpbuf[128];








cout <<"****************************************************** ";

cout << "TICKET SALES REPORT FOR DATE:";
cout <<"------------------------------------------------------ ";

cout << "SEAT CAPACITY LEFT TOTAL SOLD ";

cout <<"--------------------------------------- ";

cout <<MAX_SEAT_COUNT<<" "<<(MAX_SEAT_COUNT-Total_Sold)<<" "<<Total_Sold<<" ";

cout <<"--------------------------------------- ";

cout << "TODDLERS JUNIORS ADULTS ";

cout <<"--------------------------------------- ";

cout << TODDLERS<<" "<<JUNIORS<<" "<<ADULTS<<" ";

cout <<"--------------------------------------- ";

cout << "GROSS FOR TODAY: $"<<Gross_total<<" ";

cout <<"*************************************** ";

cout << "Press any key to exit..."<<endl;







}//close disp_final_report

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