Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Program Tiket Pesawat Jakarta-Malaysia
- // Task No.1 file 066-P04.pptx
- // Amrul Mubarak Harahap
- // 19T03 - 1901098
- #include <iostream>
- #include <string>
- #include <cstring>
- using namespace std;
- int main(){
- string napes;
- char kodeP[20], ulang;
- int kelas, hargaT, jumlahT, total;
- menu:
- system("cls");
- cout << "\t\t\t PROGRAM TIKET PESAWAT" << endl;
- cout << "\t\t\t JAKARTA - MALAYSIA" << endl;
- cout << "================================================================================" << endl;
- cout << "Masukkan Kode Pesawat [MPT/GRD/BTV]: "; cin >> kodeP;
- cout << "Kelas Pesawat: " << endl;
- cout << "\t\t1. Executive" << endl;
- cout << "\t\t2. Bisnis" << endl;
- cout << "\t\t3. Ekonomi" << endl << endl;
- cout << "Pilih Kelas [1/2/3]: "; cin >> kelas;
- if(strcmp(kodeP, "MPT") == 0 || strcmp(kodeP, "mpt") == 0){
- napes="Merpati";
- if (kelas == 1){
- hargaT = 1500000;
- } else if (kelas == 2) {
- hargaT = 900000;
- } else {
- hargaT = 500000;
- }
- } else if(strcmp(kodeP, "GRD") == 0 || strcmp(kodeP, "grd") == 0){
- napes = "Garuda";
- if (kelas == 1){
- hargaT = 1200000;
- } else if (kelas == 2){
- hargaT = 800000;
- } else {
- hargaT = 400000;
- }
- } else if(strcmp(kodeP, "BTV") == 0 || strcmp(kodeP, "btv") == 0){
- napes = "Batavia";
- if (kelas == 1){
- hargaT = 1000000;
- } else if (kelas == 2){
- hargaT = 700000;
- } else {
- hargaT = 300000;
- }
- } else {
- cout << "\nMaaf, Kode pesawat atau kelas yang anda input tidak ditemukan.";
- }
- cout << endl;
- cout << "Nama Pesawat : " << napes << endl;
- cout << "Harga Tiket : " << hargaT << endl;
- cout << "Jumlah Tiket : "; cin >> jumlahT;
- total = hargaT * jumlahT;
- cout << "Total Bayar : " << total << endl;
- cout << "\n\t\t\t\tINGIN MENGULANG?(Y/T): ";
- cin >> ulang;
- if(ulang == 'Y' || ulang == 'y'){
- goto menu;
- } else {
- goto akhir;
- }
- akhir:
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement