Untitled
#include <iostream> #include <string.h> using namespace std; double DisplayStadium(char stadiumName[]); void DisplayMatch(char matchName [], char sportName[], int chooseStadium); double CalcPackagePrice(char packageName []); double CalcAdultPrice (int quantityAdult); double CalcChildrenPrice (int quantityChildren); double CalcSeniorPrice (int quantitySenior); double CalcZonePrice (int quantity); double CalcTotalPrice (double priceAdult, double priceChildren, double priceSenior, double totalPackagePrice, double zonePrice); void DisplayPaymentDetails (char stadiumName[], char packageName[], long phoneNum, double totalPrice, char name[], int quantityAdult, int quantityChildren, int quantitySenior, char sportName [], char matchName [], int totalTicket); int main() { double priceAdult = 0.0, priceChildren = 0.0, priceSenior = 0.0, zonePrice = 0.0, totalPrice = 0.0, totalPackagePrice = 0.0; int quantity, quantityAdult, quantityChildren, quantitySenior,chooseStadium, totalTicket; char choose, name[60], stadiumName[60], packageName[40], sportName [20], matchName [90]; long phoneNum; cout<<"Welcome to TixSport Ticketing System!"; cout<<"\nDo you wish to buy ticket(s) to watch a sport match? (Y-Yes, N-No) : "; cin>>choose; while (choose != 'Y' && choose != 'y' && choose != 'N' && choose != 'n') { cout<<"Invalid Input. Enter Again (Y or N) : "; cin>>choose; } if (choose == 'Y' || choose == 'y') { cout<<"\nWe can help you!"<<endl; cout<<"\nEnter Your Name : "; cin.ignore(); cin.getline(name, 60); cout<<"\nEnter Your Mobile Number : +60 "; cin>>phoneNum; while (phoneNum < 100000000 || phoneNum > 1999999999) { cout<<"\nInvalid Phone Number. Enter Again : +60 "; cin>>phoneNum; } cout<<"\nHow many tickets would you like to buy? : "; cin>>totalTicket; cout<<"\nHow many ADULT tickets would you like to buy? : "; cin>>quantityAdult; cout<<"\nHow many CHILDREN tickets would you like to buy? : "; cin>>quantityChildren; cout<<"\nHow many SENIOR tickets would you like to buy? : "; cin>>quantitySenior; quantity = quantityAdult + quantityChildren + quantitySenior; while (totalTicket != quantity) { cout<<"\nThe number that you have entered for all three categories does not equal to the total tickets that you want to buy.\nEnter again : "; cout<<"\nHow many ADULT tickets would you like to buy? : "; cin>>quantityAdult; cout<<"\nHow many CHILDREN tickets would you like to buy? : "; cin>>quantityChildren; cout<<"\nHow many SENIOR tickets would you like to buy? : "; cin>>quantitySenior; quantity = quantityAdult + quantityChildren + quantitySenior; } DisplayStadium(stadiumName); DisplayMatch(matchName, sportName, chooseStadium); totalPackagePrice = CalcPackagePrice(packageName); priceAdult = CalcAdultPrice (quantityAdult); priceChildren = CalcChildrenPrice (quantityChildren); priceSenior = CalcSeniorPrice (quantitySenior); zonePrice = CalcZonePrice(quantity); totalPrice = CalcTotalPrice (priceAdult, priceChildren, priceSenior, totalPackagePrice, zonePrice); DisplayPaymentDetails (stadiumName, packageName, phoneNum, totalPrice, name, quantityAdult, quantityChildren, quantitySenior, sportName, matchName, totalTicket); } } double DisplayStadium(char stadiumName[]) { int chooseStadium; cout << "\nThese are the list of stadiums that you can choose to watch a match.\n\n "; cout << "==========================================================================================="<<endl; cout << "|| NUMBER || STADIUM ||"<<endl; cout << "==========================================================================================="<<endl; cout << "==========================================================================================="<<endl; cout << "|| 1 || BUKIT JALIL NASIONAL STADIUM, KUALA LUMPUR ||"<<endl; cout << "==========================================================================================="<<endl; cout << "|| 2 || MERDEKA STADIUM, KUALA LUMPUR ||"<<endl; cout << "==========================================================================================="<<endl; cout << "|| 3 || SHAH ALAM STADIUM, SHAH ALAM ||"<<endl; cout << "==========================================================================================="<<endl; cout << "\nChoose the stadium that you want (Enter the correct number only) : "; cin >> chooseStadium; while (chooseStadium < 1 || chooseStadium > 3) { cout << "\nYou've entered the wrong number. Enter the correct number."; cin >> chooseStadium; } if (chooseStadium >= 1 && chooseStadium <= 3) { if (chooseStadium == 1) strcpy(stadiumName, "BUKIT JALIL NASIONAL STADIUM, KUALA LUMPUR"); else if (chooseStadium == 2) strcpy(stadiumName, "MERDEKA STADIUM, KUALA LUMPUR"); else if (chooseStadium == 3) strcpy(stadiumName, "SHAH ALAM STADIUM, SHAH ALAM"); } return chooseStadium; } void DisplayMatch (char matchName [], char sportName[], int chooseStadium) { int chooseSport, chooseMatch; char stadiumName; cout << "\nThere are 4 sports match available for you to watch."<<endl; cout << "===========================================================================================" <<endl; cout << "|| NUMBER || SPORTS ||" <<endl; cout << "===========================================================================================" <<endl; cout << "===========================================================================================" <<endl; cout << "|| 1 || FOOTBALL ||" <<endl; cout << "===========================================================================================" <<endl; cout << "|| 2 || CRICKET ||" <<endl; cout << "===========================================================================================" <<endl; cout << "|| 3 || RUGBY ||" <<endl; cout << "===========================================================================================" <<endl; cout << "|| 4 || BASEBALL ||" <<endl; cout << "===========================================================================================" <<endl; cout << "\nWhich sport do you want to watch? (Enter the correct number only) : "; cin>>chooseSport; while (chooseSport < 1 || chooseSport > 4) { cout << "\nYou have entered the wrong number. Enter the correct number : "; cin >> chooseSport; } if (chooseSport >= 1 && chooseSport <= 4) { if (chooseSport == 1) { strcpy(sportName, "FOOTBALL"); if (chooseStadium==1) { cout<<"********************************************************* AVAILABLE MATCHES *********************************************************"<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| NUMBER || MATCHES || DATE AND TIME ||"<<endl; cout << "==================================================================================================================================="<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| 1 || SOUTH KOREA VS FRANCE || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| 2 || MALAYSIA VS ENGLAND || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "==================================================================================================================================="<<endl; cout<<"\n\nWhich match do you want to watch ? Enter the correct number only : "<<endl; cin>>chooseMatch; while (chooseMatch < 1 || chooseMatch > 2) { cout<<"\nYou have entered the wrong number. Enter the correct number : "; cin>>chooseMatch; } if (chooseMatch == 1) strcpy(matchName, "SOUTH KOREA VS FRANCE || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); else strcpy(matchName, "MALAYSIA VS ENGLAND || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); } else if (chooseStadium==2) { cout<<"********************************************************* AVAILABLE MATCHES *********************************************************"<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| NUMBER || MATCHES || DATE AND TIME ||"<<endl; cout << "==================================================================================================================================="<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| 1 || MALAYSIA VS SOUTH KOREA || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| 2 || MALAYSIA VS FRANCE || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "==================================================================================================================================="<<endl; cout<<"\n\nWhich match do you want to watch ? Enter the correct number only : "<<endl; cin>>chooseMatch; while (chooseMatch < 1 || chooseMatch > 2) { cout<<"\nYou have entered the wrong number. Enter the correct number : "; cin>>chooseMatch; } if (chooseMatch == 1) strcpy(matchName, "MALAYSIA VS SOUTH KOREA || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); else strcpy(matchName, "MALAYSIA VS FRANCE || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); } else if (chooseStadium==3) { cout<<"********************************************************* AVAILABLE MATCHES *********************************************************"<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| NUMBER || MATCHES || DATE AND TIME ||"<<endl; cout << "==================================================================================================================================="<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| 1 || SOUTH KOREA VS ENGLAND || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| 2 || ENGLAND VS FRANCE || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "==================================================================================================================================="<<endl; cout<<"\n\nWhich match do you want to watch ? Enter the correct number only : "<<endl; cin>>chooseMatch; while (chooseMatch < 1 || chooseMatch > 2) { cout<<"\nYou have entered the wrong number. Enter the correct number : "; cin>>chooseMatch; } if (chooseMatch == 1) strcpy(matchName, "SOUTH KOREA VS ENGLAND || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); else strcpy(matchName, "ENGLAND VS FRANCE || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); } } else if (chooseSport == 2) { strcpy(sportName, "CRICKET"); if (chooseStadium==1) { cout<<"********************************************************* AVAILABLE MATCHES *********************************************************"<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| NUMBER || MATCHES || DATE AND TIME ||"<<endl; cout << "==================================================================================================================================="<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| 1 || INDIA VS PAKISTAN || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| 2 || PAKISTAN VS MALAYSIA || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "==================================================================================================================================="<<endl; cout<<"\n\nWhich match do you want to watch ? Enter the correct number only : "<<endl; cin>>chooseMatch; while (chooseMatch < 1 || chooseMatch > 2) { cout<<"\nYou have entered the wrong number. Enter the correct number : "; cin>>chooseMatch; } if (chooseMatch == 1) strcpy(matchName, "INDIA VS PAKISTAN || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); else strcpy(matchName, "PAKISTAN VS MALAYSIA || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); } else if (chooseStadium==2) { cout<<"********************************************************* AVAILABLE MATCHES *********************************************************"<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| NUMBER || MATCHES || DATE AND TIME ||"<<endl; cout << "==================================================================================================================================="<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| 1 || MALAYSIA VS INDIA || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| 2 || AUSTRALIA VS PAKISTAN || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "==================================================================================================================================="<<endl; cout<<"\n\nWhich match do you want to watch ? Enter the correct number only : "<<endl; cin>>chooseMatch; while (chooseMatch < 1 || chooseMatch > 2) { cout<<"\nYou have entered the wrong number. Enter the correct number : "; cin>>chooseMatch; } if (chooseMatch == 1) strcpy(matchName, "MALAYSIA VS INDIA || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); else strcpy(matchName, "AUSTRALIA VS PAKISTAN || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); } else if (chooseStadium==3) { cout<<"********************************************************* AVAILABLE MATCHES *********************************************************"<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| NUMBER || MATCHES || DATE AND TIME ||"<<endl; cout << "==================================================================================================================================="<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| 1 || MALAYSIA VS AUSTRALIA || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| 2 || AUSTRALIA VS INDIA || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "==================================================================================================================================="<<endl; cout<<"\n\nWhich match do you want to watch ? Enter the correct number only : "<<endl; cin>>chooseMatch; while (chooseMatch < 1 || chooseMatch > 2) { cout<<"\nYou have entered the wrong number. Enter the correct number : "; cin>>chooseMatch; } if (chooseMatch == 1) strcpy(matchName, "MALAYSIA VS AUSTRALIA || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); else strcpy(matchName, "AUSTRALIA VS INDIA || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); } } else if (chooseSport == 3) { strcpy(sportName, "RUGBY"); if (chooseStadium==1) { cout<<"********************************************************* AVAILABLE MATCHES *********************************************************"<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| NUMBER || MATCHES || DATE AND TIME ||"<<endl; cout << "==================================================================================================================================="<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| 1 || SOUTH AFRICA VS FRANCE || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| 2 || NEW ZEALAND VS MALAYSIA || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "==================================================================================================================================="<<endl; cout<<"\n\nWhich match do you want to watch ? Enter the correct number only : "<<endl; cin>>chooseMatch; while (chooseMatch < 1 || chooseMatch > 2) { cout<<"\nYou have entered the wrong number. Enter the correct number : "; cin>>chooseMatch; } if (chooseMatch == 1) strcpy(matchName, "SOUTH AFRICA VS FRANCE || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); else strcpy(matchName, "NEW ZEALAND VS MALAYSIA || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); } else if (chooseStadium==2) { cout<<"********************************************************* AVAILABLE MATCHES *********************************************************"<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| NUMBER || MATCHES || DATE AND TIME ||"<<endl; cout << "==================================================================================================================================="<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| 1 || NEW ZEALAND VS FRANCE || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| 2 || MALAYSIA VS FRANCE || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "==================================================================================================================================="<<endl; cout<<"\n\nWhich match do you want to watch ? Enter the correct number only : "<<endl; cin>>chooseMatch; while (chooseMatch < 1 || chooseMatch > 2) { cout<<"\nYou have entered the wrong number. Enter the correct number : "; cin>>chooseMatch; } if (chooseMatch == 1) strcpy(matchName, "NEW ZEALAND VS FRANCE || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); else strcpy(matchName, "MALAYSIA VS FRANCE || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); } else if (chooseStadium==3) { cout<<"********************************************************* AVAILABLE MATCHES *********************************************************"<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| NUMBER || MATCHES || DATE AND TIME ||"<<endl; cout << "==================================================================================================================================="<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| 1 || SOUTH AFRICA VS NEW ZEALAND || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "==================================================================================================================================="<<endl; cout << "|| 2 || MALAYSIA VS SOUTH AFRICA || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "==================================================================================================================================="<<endl; cout<<"\n\nWhich match do you want to watch ? Enter the correct number only : "<<endl; cin>>chooseMatch; while (chooseMatch < 1 || chooseMatch > 2) { cout<<"\nYou have entered the wrong number. Enter the correct number : "; cin>>chooseMatch; } if (chooseMatch == 1) strcpy(matchName, "SOUTH AFRICA VS NEW ZEALAND || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); else strcpy(matchName, "MALAYSIA VS SOUTH AFRICA || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); } } else if (chooseSport == 4) { strcpy(sportName, "BASEBALL"); if (chooseStadium==1) { cout<<"********************************************************* AVAILABLE MATCHES ***********************************************************************"<<endl; cout << "================================================================================================================================================="<<endl; cout << "|| NUMBER || MATCHES || DATE AND TIME ||"<<endl; cout << "================================================================================================================================================="<<endl; cout << "================================================================================================================================================="<<endl; cout << "|| 1 || SOUTH KOREA VS MALAYSIA || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "================================================================================================================================================="<<endl; cout << "|| 2 || UNITED STATES OF AMERICA VS FRANCE || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "================================================================================================================================================="<<endl; cout<<"\n\nWhich match do you want to watch ? Enter the correct number only : "<<endl; cin>>chooseMatch; while (chooseMatch < 1 || chooseMatch > 2) { cout<<"\nYou have entered the wrong number. Enter the correct number : "; cin>>chooseMatch; } if (chooseMatch == 1) strcpy(matchName, "SOUTH KOREA VS MALAYSIA || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); else strcpy(matchName, "UNITED STATES OF AMERICA VS FRANCE || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); } else if (chooseStadium==2) { cout<<"********************************************************* AVAILABLE MATCHES ****************************************************************************"<<endl; cout << "======================================================================================================================================================"<<endl; cout << "|| NUMBER || MATCHES || DATE AND TIME ||"<<endl; cout << "======================================================================================================================================================"<<endl; cout << "======================================================================================================================================================"<<endl; cout << "|| 1 || UNITED STATES OF AMERICA VS GERMANY || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "======================================================================================================================================================"<<endl; cout << "|| 2 || MALAYSIA VS FRANCE || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "======================================================================================================================================================"<<endl; cout<<"\n\nWhich match do you want to watch ? Enter the correct number only : "<<endl; cin>>chooseMatch; while (chooseMatch < 1 || chooseMatch > 2) { cout<<"\nYou have entered the wrong number. Enter the correct number : "; cin>>chooseMatch; } if (chooseMatch == 1) strcpy(matchName, "UNITED STATES OF AMERICA VS GERMANY || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); else strcpy(matchName, "MALAYSIA VS FRANCE || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); } else if (chooseStadium==3) { cout<<"********************************************************* AVAILABLE MATCHES *************************************************************************"<<endl; cout << "==================================================================================================================================================="<<endl; cout << "|| NUMBER || MATCHES || DATE AND TIME ||"<<endl; cout << "==================================================================================================================================================="<<endl; cout << "==================================================================================================================================================="<<endl; cout << "|| 1 || GERMANY VS SOUTH KOREA || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "==================================================================================================================================================="<<endl; cout << "|| 2 || MALAYSIA VS UNITED STATES OF AMERICA || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM ||"<<endl; cout << "==================================================================================================================================================="<<endl; cout<<"\n\nWhich match do you want to watch ? Enter the correct number only : "<<endl; cin>>chooseMatch; while (chooseMatch < 1 || chooseMatch > 2) { cout<<"\nYou have entered the wrong number. Enter the correct number : "; cin>>chooseMatch; } if (chooseMatch == 1) strcpy(matchName, "GERMANY VS SOUTH KOREA || 6 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); else strcpy(matchName, "MALAYSIA VS UNITED STATES OF AMERICA || 9 FEBRUARY 2024 | 9.00 PM - 11.30 PM"); } } } } double CalcPackagePrice(char packageName[]) { int package, quantityPackage; double price,totalPackagePrice = 0.0; char choosePackage; cout<<"\n\nThese are the prices for the different food packages that we offer. "<<endl<<endl; cout << "=============================================================================================="<<endl; cout << "|| NUMBER || PACKAGES || PRICE PER SET ||"<<endl; cout << "=============================================================================================="<<endl; cout << "=============================================================================================="<<endl; cout << "|| 1 || ONE POPCORN, ONE SOFT DRINK || RM 9.00 ||"<<endl; cout << "=============================================================================================="<<endl; cout << "|| 2 || ONE POPCORN, TWO SOFT DRINKS || RM 11.00 ||"<<endl; cout << "=============================================================================================="<<endl; cout << "|| 3 || TWO POPCORNS, ONE SOFT DRINK || RM 15.00 ||"<<endl; cout << "=============================================================================================="<<endl; cout << "|| 4 || ONE HOTDOG , ONE SOFT DRINK || RM 8.00 ||"<<endl; cout << "=============================================================================================="<<endl; cout << "|| 5 || ONE HOTDOG , TWO SOFT DRINKS || RM 10.00 ||"<<endl; cout << "=============================================================================================="<<endl; cout << "|| 6 || TWO HOTDOGS , ONE SOFT DRINK || RM 13.00 ||"<<endl; cout << "=============================================================================================="<<endl; cout<<"\nDo you wish to buy any of the food packages shown? (Y-Yes, N-No) : "; cin>>choosePackage; while (choosePackage !='Y' && choosePackage !='y' && choosePackage !='N' && choosePackage !='n') { cout<<"\nInvalid Input. Enter Again : "; cin>>choosePackage; } if (choosePackage =='Y' || choosePackage =='y') { cout<<"\nWhat type of food sets do you desire? (Enter the correct number) : "; cin>>package; while (package < 1 || package > 6) { cout<<"\nYou have entered the wrong number. Enter the correct number : "; cin>>package; } cout<<"\nEnter the quantity of the set that you want: "; cin>>quantityPackage; if (package == 1) { price = 9.00; strcpy(packageName, "ONE POPCORN, ONE SOFT DRINK"); } else if (package == 2) { price = 11.00; strcpy(packageName, "ONE POPCORN, TWO SOFT DRINKS"); } else if (package == 3) { price = 15.00; strcpy(packageName, "TWO POPCORNS, ONE SOFT DRINK"); } else if (package == 4) { price = 8.00; strcpy(packageName, "ONE HOT DOG , ONE SOFT DRINK"); } else if (package == 5) { price = 10.00; strcpy(packageName, "ONE HOT DOG, TWO SOFT DRINKS"); } else if (package == 6) { price = 13.00; strcpy(packageName, "TWO HOT DOGS, ONE SOFT DRINK"); } totalPackagePrice += quantityPackage * price; cout<<"\nDo you wish to choose another food packages? (Y-Yes, N-No) : "; cin>>choosePackage; while (choosePackage != 'Y' && choosePackage != 'y' && choosePackage != 'N' && choosePackage != 'n') { cout<<"Invalid Input. Enter Again : "; cin>>choosePackage; } } return totalPackagePrice; } double CalcAdultPrice(int quantityAdult) { double priceAdult; priceAdult = quantityAdult * 17.50; return priceAdult; } double CalcChildrenPrice(int quantityChildren) { double priceChildren; priceChildren = quantityChildren * 12.50; return priceChildren; } double CalcSeniorPrice(int quantitySenior) { double priceSenior; priceSenior = quantitySenior * 12.50; return priceSenior; } double CalcZonePrice (int quantity) { double zonePrice; int chooseZone; cout<<"\nWhat zone do you wish to be seated? \nWe have the REGULAR ZONE and the VIP ZONE"<<endl; cout<<"\nChoose which zone do you want to be seated. (Enter 1 for REGULAR ZONE, 2 for VIP ZONE) : "; cin>>chooseZone; while ( chooseZone != 1 && chooseZone != 2 ) { cout<<"\nYou just entered the wrong number. Enter again : "; cin>>chooseZone; } if (chooseZone == 1) { zonePrice = quantity * 10.00; cout<<"\nWe have Zone A, B, C and D for Regular Zone. You can seat anywhere within these four zone as long as it is vacant."; } else { zonePrice = quantity * 30.00; cout<<"\nWe have Zone VIP 1 and Zone VIP 2. You can seat anywhere within these four zone as long as it is vacant."; } return zonePrice; } double CalcTotalPrice (double priceAdult, double priceChildren, double priceSenior, double totalPackagePrice, double zonePrice) { double totalPrice; totalPrice = priceAdult + priceChildren + priceSenior + totalPackagePrice + zonePrice; return totalPrice; } void DisplayPaymentDetails (char stadiumName[], char packageName[], long phoneNum, double totalPrice, char name[], int quantityAdult, int quantityChildren, int quantitySenior, char sportName [], char matchName [], int totalTicket) { cout<<"\n\n**************************************** PAYMENT DETAILS ****************************************"<<endl; cout<<"\n\n\t\tTicket Buyer's Name : "<<name; cout<<"Contact Number : +60"<<phoneNum; cout<<"\n\t\tTotal Tickets Bought : "<<totalTicket; cout<<"\n\t\tAdult Ticket(s) : "<<quantityAdult; cout<<"\n\t\tChildren Ticket(s) : "<<quantityChildren; cout<<"\n\t\tSenior Ticket(s) : "<<quantitySenior; cout<<"\n\t\tPackage : "<<packageName; cout<<"\n\t\tStadium : "<<stadiumName; cout<<"\n\t\tSport : "<<sportName; cout<<"\n\t\tMatch Details : "<<matchName; cout<<"\n\t\tTotal Price : RM "<<totalPrice; }
Leave a Comment