Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- #include<iomanip>
- using namespace std;
- float astroPack(string, string, string);
- int main(){
- string pCode;
- string pack, pack2;
- char ch;
- float total = 0;
- cout << " Promotion 1" << setw(19) << "\tCost Without Mini Package"<< setw(15) << "\tCost With Mini Package\n";
- cout << "---------------------------------------------------------------------------------------------------\n";
- cout << " Movies " << setw(20) << "\t69.95 " << setw(18) << "\t85.95 \n" ;
- cout << " Dynasty " << setw(19) << "\t79.95 "<< setw(21) << "\t95.95 \n" ;
- cout << "----------------------------------------------------------------------------------------------------\n\n";
- cout << " Promotion 2" << setw(19) << "\tCost Without Mini Package"<< setw(15) << "\tCost With Mini Package\n";
- cout << "-----------------------------------------------------------------------------------------------------\n";
- cout << " Movies " << setw(20) << "\t81.95 " << setw(18) << "\t97.95 \n" ;
- cout << " Dynasty " << setw(19) << "\t91.95 "<< setw(21) << "\t107.95 \n" ;
- cout << "------------------------------------------------------------------------------------------------------\n\n";
- do{
- cout << "Please choose type of promotion (1|2): ";
- cin >> pCode;
- cout << "Please enter which package: ";
- cin >> pack;
- cout << "Please enter which mini package: ";
- cin >> pack2;
- cout <<"Want to add?(y/n): "<<endl;
- cin>>ch;
- total = total + astroPack(pCode,pack,pack2);
- } while (ch=='y' || ch=='Y');
- cout << "The total charges is: RM " << fixed << setprecision(2) << total << endl;
- return 0;
- }
- float astroPack(string pCode, string pack, string pack2)
- {
- float total, charge;
- float sst;
- if (pCode == "1" && pack == "Movies" && pack2 =="A"){
- charge = 69.95;
- }
- else if (pCode == "1" && pack == "Movies" && pack2 =="B")
- {
- charge = 85.95;
- }
- else if (pCode == "1" && pack == "Dynasty" && pack2 =="A")
- {
- charge = 79.95;
- }
- else if (pCode == "1" && pack == "Dynasty" && pack2 =="B")
- {
- charge = 95.95;
- }
- else if (pCode == "2" && pack == "Movies" && pack2 =="A"){
- charge = 81.95;
- }
- else if (pCode == "2" && pack == "Movies" && pack2 =="B")
- {
- charge = 97.95;
- }
- else if (pCode == "2" && pack == "Dynasty" && pack2 =="B"){
- charge = 91.95;
- }
- else if (pCode == "2" && pack == "Dynasty" && pack2 =="A"){
- charge = 107.95;
- }
- sst = charge * 0.1;
- total = charge + sst;
- return total;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement