1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146
|
//AI TRAVEL & TOURS
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
char name[100], packageCode, mealResult, addCustResult;
int childrenNum, childrenPrice, adultNum, adultPrice, i = 1, mealCharge = 0, aCount = 0, bCount = 0, cCount =0;
bool meal = false, addCust = true;
double totalBeforeSST, totalWithSST, totalSST, sst = 0.06, totalSales = 0;
string packageName;
while(i>0 && addCust) {
// START GET_INPUT_FROM_USER
cout << "Enter customer's name: " ;
cin.getline(name, 100);
cout << "Enter package code: " ;
cin >> packageCode;
cout << "Enter number of adults: ";
cin >> adultNum;
cout << "Enter number of children: ";
cin >> childrenNum;
cout << "Do you want to add meals your package? (Y/N): ";
cin >> mealResult;
// END GET_INPUT_FROM_USER
// MEAL SECTION
if(mealResult == 'Y' || mealResult == 'y'){
!meal;
} else {
meal;
}
if(!meal){
mealCharge = (adultNum*50) + (childrenNum*30);
}
// END MEAL SECTION
// START PACKAGE SELECTION
if(packageCode == 'A' || packageCode == 'a'){
packageName = "Langkawi Free & Easy";
adultPrice = 200.00;
childrenPrice = 150.00;
aCount++;
} else if(packageCode == 'B' || packageCode == 'b'){
packageName = "Langkawi Island & Nature";
adultPrice = 250.00;
childrenPrice = 200.00;
bCount++;
} else if(packageCode == 'C' || packageCode == 'c'){
packageName = "Langkawi Culture & Historical";
adultPrice = 300.00;
childrenPrice = 250.00;
cCount++;
} else {
cout << "You have entered invalid Package Code. Please Try Again" << endl;
}
// END PACKAGE CODE SELECTION
// TOTAL PROCESS
totalBeforeSST = (adultNum*adultPrice) + (childrenNum*childrenPrice) + mealCharge;
totalSST = totalBeforeSST * sst;
totalWithSST = totalBeforeSST + totalSST;
totalSales = totalSales + totalWithSST;
// RECEIPT
cout.setf(ios::fixed);
cout.precision(2);
cout << endl;
cout << "RECEIPT" << endl;
cout << "------------------------------------------" << endl;
cout << "Customer's name : " << name << endl;
cout << "Package code : " << packageCode << endl;
cout << "Package name : " << packageName << endl;
cout << "Add meals : " << mealResult << endl;
cout << "Total before SST : RM" << totalBeforeSST << endl;
cout << "Total SST : RM" << totalSST << endl;
cout << "Total with SST : RM" << totalWithSST << endl;
cout << "------------------------------------------" << endl;
// END RECEIPT
// ASK USER FOR ADD ANOTHER CUSTOMER
cout << "\nAdd another customer? (Y/N) : ";
cin >> addCustResult;
cout << endl;
if(addCustResult == 'Y' || addCustResult == 'y' ) {
addCust;
} else if(addCustResult == 'N' || addCustResult == 'n'){
addCust = !addCust;
}
if(!addCust){
break;
}
i++;
}
cout << "AI TRAVEL & TOURS" << endl;
cout << "*********************************************" << endl;
cout << "Package A : " << aCount << endl;
cout << "Package B : " << bCount << endl;
cout << "Package C : " << cCount << endl;
cout << "Total sales : RM" << totalSales << endl;
cout << "*********************************************" << endl;
return 0;
}
| |