Advertisement
khisby

[Soal1]discount_policy_keith's_sheet_music

Oct 9th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.64 KB | None | 0 0
  1. // Khisby Al Ghofari, 06.2017.1.06852, Kelas B
  2. #include <iostream>
  3.  
  4. using namespace std;
  5.  
  6. int main()
  7. {
  8.     int menu,total,discount,total_discount,after_discount,sales_tax,total_price  ;
  9.     cout << "\n==============================================\n";
  10.     cout << "Welcome To \n";
  11.     cout << "Application discount policy Keith's Sheet Music\n";
  12.     cout << "================================================\n \n";
  13.  
  14.     cout << "Select menu: \n";
  15.     cout << "1. Theacher \n";
  16.     cout << "2. Non-Theacher \n";
  17.  
  18.     cout << "\n\nInput the number of menu : ";
  19.     cin >> menu;
  20.  
  21.     cout << "Input total purchases : $";
  22.     cin >> total;
  23.  
  24.     if(menu == 1){
  25.         if(total >= 100){
  26.             discount= 12;
  27.         }else{
  28.             discount= 10;
  29.         }
  30.  
  31.         total_discount = total*discount/100;
  32.         after_discount = total-total_discount;
  33.         sales_tax = after_discount*5/100;
  34.         total_price = after_discount-sales_tax;
  35.  
  36.  
  37.         cout << "\n\n\Total purchases \t\t $" << total << "\n";
  38.         cout << "Theacher's discount ("<< discount << "%) \t " << total_discount << "\n";
  39.         cout << "Discounted total \t\t " << after_discount << "\n";
  40.         cout << "Sales Tax (5%) \t\t\t " << sales_tax << "\n";
  41.         cout << "Total \t\t\t\t $" << total_price << "\n\n";
  42.     }else if(menu == 2){
  43.         sales_tax = total*5/100;
  44.         total_price = total-sales_tax;
  45.         cout << "\n\nTotal purchases \t $" << total << "\n";
  46.         cout << "Sales Tax (5%) \t\t " << sales_tax << "\n";
  47.         cout << "Total \t\t\t $" << total_price << "\n\n";
  48.     }else{
  49.         cout << "Your input is invalid";
  50.     }
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement