#include<conio.h>
#include<iostream>
#include<string.h>
#include<stdio.h>
//Nama : Asiyah Thufailah
//Nim : 3420210005
void main() {
char nama_kereta[23],nama_pemesan[23],kode_kereta[23],lagi,discount[50];
int harga, kls, jml, pb, bt, dc, tp, ub, uk, dcs;
clrscr();
awal:
printf("==========================================================================\n");
printf("\t\tPROGRAM TIKET KERETA\n");
printf("==========================================================================\n");
printf("Kelas \tAG(Argo Bromo)\tAL(Argo Lawu)\PH(Argo Willis)\n");
printf("1-Executive \t500000 \t475000 \t450000\n");
printf("2-Bisnis \t480000 \t455000 \t430000\n");
printf("3-Ekonomi \t460000 \t435000 \t410000\n");
printf("==========================================================================\n");
printf("Ketentuan Discount:\n");
printf("Apabila pembelian tiket diatas 10 maka diskon 10% Dari Total\n");
printf("Apabila pembelian tiket diatas 5 maka diskon 5% Dari Total\n");
printf("==========================================================================\n");
printf("Ketentuan Biaya Tambahan:\n");
printf("Kelas Executive adalah 3% Dari Total\n");
printf("Kelas Bisnis 2% Dari Total\n");
printf("Kelas Ekonomi 1% Dari Total\n");
printf("==========================================================================\n");
printf("Ketentuan Salah Input:\n");
printf("Jika Salah Input Kode Kereta Atau Kode Kelas Salah Maka Muncul Pesan\n");
printf("Setelah Muncul Pesan Lalu Pertanyaan Ingin Input Lagi\n");
printf("==========================================================================\n");
printf("Ketentuan Kondisi:\n");
printf("Program Harus Menggunakan Switch Case dan If Else <Posisi Bebas>\n");
printf("==========================================================================\n");
cout<<"Nama Pemesan\t\t\t:";
cin>>nama_pemesan;
clrscr();
cout<<"masukan kode kereta [AG/AL/PH]:\n\n";
cin>>kode_kereta;
cout<<"\npilihan kelas[1/2/3]:n\n";
cout<<"1. Eksekutif\n";
cout<<"2. Bisnis\n";
cout<<"3. Ekonomi\n\n";
cout<<"Masukkan Kelas[1/2/3]:\t";
cin>>kls;
atas:
clrscr();
cout<<"\t\t\tDAFTAR PEMESANAN TIKET KERETA\n";
printf("===========================================================================\n");
if(strcmp(kode_kereta,"AG")==0||strcmp(kode_kereta'"ag")==0)
{
strcpy(nama_kereta,"Argo Bromo");
if(kls==1);
harga=500000;
else if(kls==2)
harga=480000;
else if(kls==3)
harga=460000
}
else if (strcmp(kode_kereta,"AL")==0||strcmp(kode_kereta,"al")==0)
{
strcpy(nama_kereta,"Argo Lawu");
if(kls==1);
harga=475000;
else if(kls==2)
harga=455000;
else if(kls==3)
harga=435000;
}
else if (strcmp(kode_kereta,"PH")==0||strcmp(kode_kereta,"ph")==0)
{
strcpy(nama_kereta,"Argo Wilis");
if(kls==1);
harga=450000;
else if(kls==2)
harga=430000;
else if(kls==3)
harga=410000;
}
else {
cout<<"\n\nMaaf Kode Yang Anda Masukan Salah"<<endl<<endl;
cout<<"\n\n\n\n\n\t\t\t\tinput ulang[Y/T]?:";cin>>lagi;
if(lagi=='Y'||lagi=='y')
goto atas;
else
goto bawah;
}
cout<<"Nama Pemesan\t\t\t:"<<nama_pemesan<<endl;
cout<<"Kode Kereta\t\t\t:"<<kode_kereta<<endl;
cout<<"Kode Kelas\t\t\t:"<<kls<<endl;
cout<<"Nama Kereta\t\t\t:"<<nama_kereta<<endl;
cout<<"Harga tiket\t\t\t:Rp."<<harga<<endl;
cout<<"jumlah Beli\t\t\t:";
cin>>jml;
pb=harga*jml+bt;
cout<<"Total\t\t\t\t:"<<pb<<endl;
dcs=50500;
cout<<"discount\t\t\t:"<<dcs<<endl;
bt=60200;
cout<<"Biaya tambahan\t\t\t:"<<bt<<endl;
printf("===========================================================================\n");
tp=0.25*pb;
cout<<"Grand Total\t\t\t:Rp."<<tp<<endl;
cout<<"uang bayar\t\t\t:Rp.";
cin>>ub;
uk=ub-tp-dcs;
cout<<"uang kembali\t\t\t:Rp."<<uk<<endl;
printf("===========================================================================\n");
cout<<" \n\n\n\n\t\t\t\t\ INGIN INPUT LAGI [Y/T]?:";cin>>lagi;
if(lagi=='Y'||lagi=='y')
goto atas;
else
goto bawah;
bawah:
{
clrscr();
cout<<"\n\n\n\n\n\t\t==================================\n ";
cout<<"\t\t\t....TERIMAKASIH....\n ";
cout<<"\t\t================================== ";
}
getch();
}