Advertisement
amrulHarahap

Program Tiket Pesawat

Dec 19th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.92 KB | None | 0 0
  1. // Program Tiket Pesawat Jakarta-Malaysia
  2. // Task No.1 file 066-P04.pptx
  3. // Amrul Mubarak Harahap
  4. // 19T03 - 1901098
  5.  
  6. #include <iostream>
  7. #include <string>
  8. #include <cstring>
  9. using namespace std;
  10.  
  11. int main(){
  12.     string napes;
  13.     char kodeP[20], ulang;
  14.     int kelas, hargaT, jumlahT, total;
  15.  
  16.     menu:
  17.     system("cls");
  18.     cout << "\t\t\t    PROGRAM TIKET PESAWAT" << endl;
  19.     cout << "\t\t\t     JAKARTA - MALAYSIA" << endl;
  20.     cout << "================================================================================" << endl;
  21.  
  22.     cout << "Masukkan Kode Pesawat [MPT/GRD/BTV]: "; cin >> kodeP;
  23.  
  24.     cout << "Kelas Pesawat: " << endl;
  25.     cout << "\t\t1. Executive" << endl;
  26.     cout << "\t\t2. Bisnis" << endl;
  27.     cout << "\t\t3. Ekonomi" << endl << endl;
  28.  
  29.     cout << "Pilih Kelas [1/2/3]: "; cin >> kelas;
  30.  
  31.     if(strcmp(kodeP, "MPT") == 0 || strcmp(kodeP, "mpt") == 0){
  32.         napes="Merpati";
  33.         if (kelas == 1){
  34.             hargaT = 1500000;
  35.         } else if (kelas == 2) {
  36.             hargaT = 900000;
  37.         } else {
  38.             hargaT = 500000;
  39.         }
  40.  
  41.     } else if(strcmp(kodeP, "GRD") == 0 || strcmp(kodeP, "grd") == 0){
  42.         napes = "Garuda";
  43.         if (kelas == 1){
  44.             hargaT = 1200000;
  45.         } else if (kelas == 2){
  46.             hargaT = 800000;
  47.         } else {
  48.             hargaT = 400000;
  49.         }
  50.  
  51.     } else if(strcmp(kodeP, "BTV") == 0 || strcmp(kodeP, "btv") == 0){
  52.         napes = "Batavia";
  53.         if (kelas == 1){
  54.             hargaT = 1000000;
  55.         } else if (kelas == 2){
  56.             hargaT = 700000;
  57.         } else {
  58.             hargaT = 300000;
  59.         }
  60.     } else {
  61.         cout << "\nMaaf, Kode pesawat atau kelas yang anda input tidak ditemukan.";
  62.     }
  63.  
  64.     cout << endl;
  65.     cout << "Nama Pesawat   : " << napes << endl;
  66.     cout << "Harga Tiket    : " << hargaT << endl;
  67.     cout << "Jumlah Tiket   : "; cin >> jumlahT;
  68.  
  69.     total = hargaT * jumlahT;
  70.  
  71.     cout << "Total Bayar    : " << total << endl;
  72.  
  73.     cout << "\n\t\t\t\tINGIN MENGULANG?(Y/T): ";
  74.     cin >> ulang;
  75.  
  76.     if(ulang == 'Y' || ulang == 'y'){
  77.         goto menu;
  78.     } else {
  79.         goto akhir;
  80.     }
  81.  
  82.     akhir:
  83.     return 0;
  84. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement