Advertisement
iqrammm

Untitled

Dec 2nd, 2020
788
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.88 KB | None | 0 0
  1. #include<iostream>
  2. #include<iomanip>
  3. using namespace std;
  4.  
  5. float astroPack(string, string, string);
  6.  
  7. int main(){
  8.     string pCode;
  9.     string pack, pack2;
  10.     char ch;
  11.     float total = 0;
  12.    
  13.  
  14.     cout << " Promotion 1"   << setw(19) << "\tCost Without Mini Package"<< setw(15) << "\tCost With Mini Package\n";
  15.     cout << "---------------------------------------------------------------------------------------------------\n";
  16.     cout << " Movies  "   << setw(20) << "\t69.95  " << setw(18) << "\t85.95  \n" ;
  17.     cout << " Dynasty  "  << setw(19) << "\t79.95  "<< setw(21) << "\t95.95  \n" ;
  18.     cout << "----------------------------------------------------------------------------------------------------\n\n";
  19.  
  20.     cout << " Promotion 2"   << setw(19) << "\tCost Without Mini Package"<< setw(15) << "\tCost With Mini Package\n";
  21.     cout << "-----------------------------------------------------------------------------------------------------\n";
  22.     cout << " Movies  "  << setw(20) << "\t81.95  " << setw(18) << "\t97.95  \n" ;
  23.     cout << " Dynasty  " << setw(19) << "\t91.95  "<< setw(21) << "\t107.95  \n" ;
  24.     cout << "------------------------------------------------------------------------------------------------------\n\n";
  25.        
  26.        
  27.     do{
  28.         cout << "Please choose type of promotion (1|2): ";
  29.         cin >> pCode;
  30.        
  31.         cout << "Please enter which package: ";
  32.         cin >> pack;
  33.        
  34.         cout << "Please enter which mini package: ";
  35.         cin >> pack2;
  36.        
  37.  
  38.  
  39.         cout <<"Want to add?(y/n): "<<endl;
  40.         cin>>ch;
  41.  
  42.         total = total + astroPack(pCode,pack,pack2);
  43.     } while (ch=='y' || ch=='Y');
  44.         cout << "The total charges is: RM " << fixed << setprecision(2) << total  << endl;
  45.         return 0;
  46.     }
  47.        
  48.  
  49. float astroPack(string pCode, string pack, string pack2)
  50. {
  51.     float total, charge;
  52.     float sst;
  53.                
  54.     if (pCode == "1" && pack == "Movies" && pack2 =="A"){
  55.         charge = 69.95;    
  56.     }
  57.     else if (pCode == "1" && pack == "Movies" && pack2 =="B")
  58.     {
  59.         charge = 85.95;
  60.     }
  61.        
  62.                        
  63.  
  64.     else if (pCode == "1" && pack == "Dynasty" && pack2 =="A")
  65.     {
  66.         charge = 79.95;
  67.     }
  68.            
  69.     else if (pCode == "1" && pack == "Dynasty" && pack2 =="B")
  70.     {
  71.         charge = 95.95;
  72.     }
  73.        
  74.        
  75.     else if (pCode == "2" && pack == "Movies" && pack2 =="A"){
  76.         charge = 81.95;    
  77.     }
  78.     else if (pCode == "2" && pack == "Movies" && pack2 =="B")
  79.     {
  80.         charge = 97.95;
  81.     }
  82.        
  83.                        
  84.  
  85.     else if (pCode == "2" && pack == "Dynasty" && pack2 =="B"){
  86.         charge = 91.95;
  87.     }
  88.     else if (pCode == "2" && pack == "Dynasty" && pack2 =="A"){
  89.         charge = 107.95;
  90.     }
  91.  
  92.     sst = charge * 0.1;
  93.     total = charge + sst;
  94.    
  95.     return total;
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement