#include<iostream.h>
#include<conio.h>
#include<iomanip.h>
int garis()
{
int i;
for(i=1;i<=42;i++)
{
cout<<"-";
}
cout<<"\n";
}
int main()
{
int jur,wkt,umr,kls,jum;
char setuju;
long total;
long tarif[2][2][2][3]=
{
{
{{200000,150000,100000},{100000,50000,20000}},{{250000,200000,180000},{210000,160000,140000}
}
},
{
{
{180000,130000,80000},{80000,30000,10000}},{{220000,180000,160000},{200000,140000,120000}}
}
};
cout<<"\n||||||||||||||||||||||||||||||||||||||||||\n";
cout<<"||| PEMESANAN TIKET KERETA API ONLINE |||\n";
cout<<"||||||||||||||||||||||||||||||||||||||||||\n\n";
jur:
garis();
cout<<"\n||||||||||||||||\n";
cout<<"|| MENU UTAMA ||\n";
cout<<"||||||||||||||||\n\n";
garis();
cout<<"Silahkan Pilih Jurusan\n";
garis();
cout<<"1.Jakarta\n";
cout<<"2.Surabaya\n";
cout<<"3.Exit\n";
cout<<"Pilih[1-3]: ";
cin>>jur;
cout<<"Apakah Anda Setuju(y/n) : ";
cin>>setuju;
if(setuju == 'y' || setuju == 'Y')
{
goto jur2;
}
else if(setuju == 'n' || setuju == 'N')
{
goto jur;
}
jur2:
if(jur <1 || jur>3)
{
clrscr();
garis();
cout<<"KODE YANG ANDA MASUKKAN SALAH...!!\n";
cout<<"Silahkan Ulangi\n";
goto jur;
}
else if(jur==3)
{
return 0;
}
clrscr();
wkt:
garis();
cout<<"WAKTU >>\n";
garis();
cout<<"1.Siang (14.00 WIB)\n";
cout<<"2.Malam (20.00 WIB)\n";
cout<<"3.Sebelumnya\n";
cout<<"4.Menu Utama\n";
cout<<"5.Exit\n";
cout<<"Pilih[1-4]: ";
cin>>wkt;
cout<<"Apakah Anda Setuju(y/n) : ";
cin>>setuju;
if(setuju == 'y' || setuju == 'Y')
{
goto wkt2;
}
else if(setuju == 'n' || setuju == 'N')
{
goto wkt;
}
wkt2:
if(wkt <1 || wkt>5)
{
clrscr();
garis();
cout<<"KODE YANG ANDA MASUKKAN SALAH...!!\n";
cout<<"Silahkan Ulangi\n";
goto wkt;
}
else if(wkt==3 || wkt==4)
{
goto jur;
}
else if(wkt==5)
{
return 0;
}
clrscr();
umr:
garis();
cout<<"UMUR >>\n";
garis();
cout<<"1.Dewasa\n";
cout<<"2.Anak-anak\n";
cout<<"3.Sebelumnya\n";
cout<<"4.Menu Utama\n";
cout<<"5.Exit\n";
cout<<"Pilih[1-5]: ";
cin>>umr;
cout<<"Apakah Anda Setuju(y/n) : ";
cin>>setuju;
if(setuju == 'y' || setuju == 'Y')
{
goto umr2;
}
else if(setuju == 'n' || setuju == 'N')
{
goto umr;
}
umr2:
if(umr <1 || umr>5)
{
clrscr();
garis();
cout<<"KODE YANG ANDA MASUKKAN SALAH...!!\n";
cout<<"Silahkan Ulangi\n";
goto umr;
}
else if(umr==3)
{
goto wkt;
}
else if(umr==4)
{
goto jur;
}
else if(umr==5)
{
return 0;
}
clrscr();
kls:
garis();
cout<<"KELAS >>\n";
garis();
cout<<"1.Eksekutif\n";
cout<<"2.Bisnis\n";
cout<<"3.Ekonomi\n";
cout<<"4.Sebelumnya\n";
cout<<"5.Menu Utama\n";
cout<<"6.Exit\n";
cout<<"Pilih[1-6]: ";
cin>>kls;
cout<<"Apakah Anda Setuju(y/n) : ";
cin>>setuju;
if(setuju == 'y' || setuju == 'Y')
{
goto kls2;
}
else if(setuju == 'n' || setuju == 'N')
{
goto kls;
}
kls2:
if(kls <1 || kls>6)
{
clrscr();
garis();
cout<<"KODE YANG ANDA MASUKKAN SALAH...!!\n";
cout<<"Silahkan Ulangi\n";
goto kls;
}
else if(kls==4)
{
goto umr;
}
else if(kls==5)
{
goto jur;
}
else if(kls==6)
{
return 0;
}
clrscr();
garis();
cout<<"Harga 1 tiket Rp."<<tarif[jur-1][wkt-1][umr-1][kls-1]<<endl;
tiket:
cout<<"\nJUMLAH TIKET YANG DIPESAN : ";
cin>>jum;
cout<<"Apakah Anda Setuju(y/n) : ";
cin>>setuju;
if(setuju == 'y' || setuju == 'Y')
{
goto tiket2;
}
else if(setuju == 'n' || setuju == 'N')
{
goto tiket;
}
tiket2:
clrscr();
garis();
cout<<"RINCIAN :\n";
garis();
cout<<"JURUSAN : ";
switch(jur)
{
case 1 : cout<<"Jakarta\n";
break;
case 2 : cout<<"Surabaya\n";
break;
}
cout<<"WAKTU : ";
switch(wkt)
{
case 1 : cout<<"Siang\n";
break;
case 2 : cout<<"Malam\n";
break;
}
cout<<"UMUR : ";
switch(wkt)
{
case 1 : cout<<"Dewasa\n";
break;
case 2 : cout<<"Anak-anak\n";
break;
}
cout<<"KELAS : ";
switch(kls)
{
case 1 : cout<<"Eksekutif\n";
break;
case 2 : cout<<"Bisnis\n";
break;
case 3 : cout<<"Ekonomi\n";
break;
}
cout<<"HARGA 1 TIKET : Rp."<<tarif[jur-1][wkt-1][umr-1][kls-1]<<endl;
cout<<"JUMLAH TIKET : "<<jum<<" buah"<<endl;
total=(tarif[jur-1][wkt-1][umr-1][kls-1])*jum;
cout<<"TOTAL HARGA : Rp."<<total<<endl;
garis();
return 0;
}
#include<conio.h>
#include<iomanip.h>
int garis()
{
int i;
for(i=1;i<=42;i++)
{
cout<<"-";
}
cout<<"\n";
}
int main()
{
int jur,wkt,umr,kls,jum;
char setuju;
long total;
long tarif[2][2][2][3]=
{
{
{{200000,150000,100000},{100000,50000,20000}},{{250000,200000,180000},{210000,160000,140000}
}
},
{
{
{180000,130000,80000},{80000,30000,10000}},{{220000,180000,160000},{200000,140000,120000}}
}
};
cout<<"\n||||||||||||||||||||||||||||||||||||||||||\n";
cout<<"||| PEMESANAN TIKET KERETA API ONLINE |||\n";
cout<<"||||||||||||||||||||||||||||||||||||||||||\n\n";
jur:
garis();
cout<<"\n||||||||||||||||\n";
cout<<"|| MENU UTAMA ||\n";
cout<<"||||||||||||||||\n\n";
garis();
cout<<"Silahkan Pilih Jurusan\n";
garis();
cout<<"1.Jakarta\n";
cout<<"2.Surabaya\n";
cout<<"3.Exit\n";
cout<<"Pilih[1-3]: ";
cin>>jur;
cout<<"Apakah Anda Setuju(y/n) : ";
cin>>setuju;
if(setuju == 'y' || setuju == 'Y')
{
goto jur2;
}
else if(setuju == 'n' || setuju == 'N')
{
goto jur;
}
jur2:
if(jur <1 || jur>3)
{
clrscr();
garis();
cout<<"KODE YANG ANDA MASUKKAN SALAH...!!\n";
cout<<"Silahkan Ulangi\n";
goto jur;
}
else if(jur==3)
{
return 0;
}
clrscr();
wkt:
garis();
cout<<"WAKTU >>\n";
garis();
cout<<"1.Siang (14.00 WIB)\n";
cout<<"2.Malam (20.00 WIB)\n";
cout<<"3.Sebelumnya\n";
cout<<"4.Menu Utama\n";
cout<<"5.Exit\n";
cout<<"Pilih[1-4]: ";
cin>>wkt;
cout<<"Apakah Anda Setuju(y/n) : ";
cin>>setuju;
if(setuju == 'y' || setuju == 'Y')
{
goto wkt2;
}
else if(setuju == 'n' || setuju == 'N')
{
goto wkt;
}
wkt2:
if(wkt <1 || wkt>5)
{
clrscr();
garis();
cout<<"KODE YANG ANDA MASUKKAN SALAH...!!\n";
cout<<"Silahkan Ulangi\n";
goto wkt;
}
else if(wkt==3 || wkt==4)
{
goto jur;
}
else if(wkt==5)
{
return 0;
}
clrscr();
umr:
garis();
cout<<"UMUR >>\n";
garis();
cout<<"1.Dewasa\n";
cout<<"2.Anak-anak\n";
cout<<"3.Sebelumnya\n";
cout<<"4.Menu Utama\n";
cout<<"5.Exit\n";
cout<<"Pilih[1-5]: ";
cin>>umr;
cout<<"Apakah Anda Setuju(y/n) : ";
cin>>setuju;
if(setuju == 'y' || setuju == 'Y')
{
goto umr2;
}
else if(setuju == 'n' || setuju == 'N')
{
goto umr;
}
umr2:
if(umr <1 || umr>5)
{
clrscr();
garis();
cout<<"KODE YANG ANDA MASUKKAN SALAH...!!\n";
cout<<"Silahkan Ulangi\n";
goto umr;
}
else if(umr==3)
{
goto wkt;
}
else if(umr==4)
{
goto jur;
}
else if(umr==5)
{
return 0;
}
clrscr();
kls:
garis();
cout<<"KELAS >>\n";
garis();
cout<<"1.Eksekutif\n";
cout<<"2.Bisnis\n";
cout<<"3.Ekonomi\n";
cout<<"4.Sebelumnya\n";
cout<<"5.Menu Utama\n";
cout<<"6.Exit\n";
cout<<"Pilih[1-6]: ";
cin>>kls;
cout<<"Apakah Anda Setuju(y/n) : ";
cin>>setuju;
if(setuju == 'y' || setuju == 'Y')
{
goto kls2;
}
else if(setuju == 'n' || setuju == 'N')
{
goto kls;
}
kls2:
if(kls <1 || kls>6)
{
clrscr();
garis();
cout<<"KODE YANG ANDA MASUKKAN SALAH...!!\n";
cout<<"Silahkan Ulangi\n";
goto kls;
}
else if(kls==4)
{
goto umr;
}
else if(kls==5)
{
goto jur;
}
else if(kls==6)
{
return 0;
}
clrscr();
garis();
cout<<"Harga 1 tiket Rp."<<tarif[jur-1][wkt-1][umr-1][kls-1]<<endl;
tiket:
cout<<"\nJUMLAH TIKET YANG DIPESAN : ";
cin>>jum;
cout<<"Apakah Anda Setuju(y/n) : ";
cin>>setuju;
if(setuju == 'y' || setuju == 'Y')
{
goto tiket2;
}
else if(setuju == 'n' || setuju == 'N')
{
goto tiket;
}
tiket2:
clrscr();
garis();
cout<<"RINCIAN :\n";
garis();
cout<<"JURUSAN : ";
switch(jur)
{
case 1 : cout<<"Jakarta\n";
break;
case 2 : cout<<"Surabaya\n";
break;
}
cout<<"WAKTU : ";
switch(wkt)
{
case 1 : cout<<"Siang\n";
break;
case 2 : cout<<"Malam\n";
break;
}
cout<<"UMUR : ";
switch(wkt)
{
case 1 : cout<<"Dewasa\n";
break;
case 2 : cout<<"Anak-anak\n";
break;
}
cout<<"KELAS : ";
switch(kls)
{
case 1 : cout<<"Eksekutif\n";
break;
case 2 : cout<<"Bisnis\n";
break;
case 3 : cout<<"Ekonomi\n";
break;
}
cout<<"HARGA 1 TIKET : Rp."<<tarif[jur-1][wkt-1][umr-1][kls-1]<<endl;
cout<<"JUMLAH TIKET : "<<jum<<" buah"<<endl;
total=(tarif[jur-1][wkt-1][umr-1][kls-1])*jum;
cout<<"TOTAL HARGA : Rp."<<total<<endl;
garis();
return 0;
}
No comments:
Post a Comment