Advertisement
amrulHarahap

Program Gerobak KFC

Dec 19th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.68 KB | None | 0 0
  1. // Program Gerobak Fried Chicken
  2. // Task file 066-P06.pptx
  3. // Amrul Mubarak Harahap
  4. // 19T03 - 1901098
  5.  
  6. #include <iostream>
  7. #include <cstring>
  8. #include <string>
  9. using namespace std;
  10.  
  11.  
  12. int main(){
  13.     int x;
  14.     long harga[6] = {2500, 2000, 1500}, banyakPtg[6], jumlahHrg[6] = {0},
  15.         jumlahByr[6] = {0}, pajak[6], total[6];
  16.     char kode[6] = {'D','d', 'P', 'p', 'S', 's'}, ulang;
  17.     string jenis[6];
  18.  
  19.     menu:
  20.     system("cls");
  21.     cout << "Gerobak Fried Chicken" << endl;
  22.     cout << "=======================" << endl;
  23.     cout << "Kode    Jenis    Harga" << endl;
  24.     cout << "=======================" << endl;
  25.     cout << "D       Dada     2500" << endl;
  26.     cout << "P       Paha     2000" << endl;
  27.     cout << "S       Sayap    1500" << endl;
  28.     cout << "=======================" << endl;
  29.  
  30.     cout << "Banyak Pesanan: "; cin >> x;
  31.    
  32.         for(int i=0; i < x; i++){
  33.             cout<<"\nPesanan ke-" << i+1 <<endl;
  34.             cout << "Kode Potong [D/P/S]: "; cin >> kode[i];
  35.             cout << "Banyak Potong      : "; cin >> banyakPtg[i];
  36.             cout<<endl;
  37.  
  38.             if(kode[i] == 'D' || kode[i] == 'd'){
  39.                 jenis[i] = "Dada";
  40.                 harga[i] = 2500;
  41.             }
  42.             else if(kode[i] == 'P' || kode[i] == 'p'){
  43.                 jenis[i] = "Paha";
  44.                 harga[i] = 2000;
  45.             }
  46.             else if(kode[i] == 'S' || kode[i] == 's'){
  47.                 jenis[i] = "Sayap";
  48.                 harga[i] = 1500;
  49.             } else {
  50.                 cout << "Kode yang Anda masukkan tidak tersedia.";
  51.                 cout << "\n\t\t\t\tINGIN MENGULANG?(Y/T): "; cin >> ulang;
  52.  
  53.                 if(ulang == 'Y' || ulang == 'y'){
  54.                     goto menu;
  55.                 } else {
  56.                     goto akhir;
  57.                 }
  58.             }
  59.  
  60.             jumlahByr[x] += banyakPtg[i] * harga[i];
  61.             pajak[x] = (10*jumlahByr[x])/100;
  62.             total[x] = jumlahByr[x] + pajak[x];
  63.  
  64.         }
  65.  
  66.     cout << "==============================================" << endl;
  67.     cout << "No. Jenis    Harga      Banyak      Jumlah"<<endl;
  68.     cout << "    Potong   Satuan     Potong      Harga"<<endl;
  69.    
  70.     cout << "==============================================" << endl;
  71.  
  72.    
  73.     for(int i = 0; i < x; i++){
  74.         jumlahHrg[i] = banyakPtg[i] * harga[i];
  75.         cout << " "<< i+1 << "  " << jenis[i] << "     " << harga[i];
  76.         cout << "        " << banyakPtg[i] << "         " << jumlahHrg[i] << endl;
  77.     }
  78.  
  79.  
  80.     cout << "==============================================" << endl;
  81.     cout << "Jumlah Bayar : Rp" << jumlahByr[x] << endl;
  82.     cout << "Pajak 10%    : Rp" << pajak[x] << endl;
  83.     cout << "Total Bayar  : Rp" << total[x] << endl;
  84.    
  85.     cout << "\n\t\t\t\tINGIN MENGULANG?(Y/T): "; cin >> ulang;
  86.  
  87.         if(ulang == 'Y' || ulang == 'y'){
  88.             goto menu;
  89.         } else {
  90.             goto akhir;
  91.         }
  92.  
  93.    
  94.     akhir:
  95.     return 0;
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement