Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <conio.h>
- #include <iostream.h>
- #include <stdio.h>
- #define tanggal __DATE__
- #define waktu __TIME__
- main(){
- int J1hh,J1mm,J1ss;
- int J2hh,J2mm,J2ss;
- int J3hh,J3mm,J3ss;
- char nopol1[25];
- char nopol2[25];
- int totaldetik1,totaldetik2,selisihdetik,sisa;
- int bayar_parkir;
- char key;
- int pilih;
- char warna1[10];
- char warna2[10];
- cout<<"\n\n\n\t\t =================================\n\n";
- cout<<"\t\t => WELCOME TO OUR PROGRAM <=\n";
- cout<<"\n\t\t =================================\n";
- cout<<"\t\t * * * * * * * * * * * * * * * * * \n";
- cout<<"\t\t # # # # # # # # # # # \n";
- cout<<"\t\t * * * * * * * * * * * * * * * * * \n\n";
- cout<<"\t\t\t *>Date = "<<tanggal<<endl;
- cout<<"\t\t\t *>Time = "<<waktu<<endl<<endl;
- cout<<"\t\t * * * * * * * * * * * * * * * * * \n";
- cout<<"\t\t # # # # # # # # # # # \n";
- cout<<"\t\t * * * * * * * * * * * * * * * * * \n";
- cout<<"\n\t\t Please Press Any Keys ............";
- getch();
- clrscr;
- do{
- clrscr();
- cout<<"\t\t ===================================\n";
- cout<<"\t\t S M A R T S Y S T E M P A R K\n";
- cout<<"\t\t ===================================\n";
- cout<<"\t\t\t <<-- MENU YANG DIGUNAKAN -->>"<<endl;
- cout<<"\t\t\t <<--------------------------->>"<<endl<<endl;
- cout<<"\t\t\t 1. MOBIL YANG INGIN MASUK "<<endl;
- cout<<"\t\t\t 2. MOBIL YANG INGIN KELUAR "<<endl;
- cout<<"\t\t\t 3. TENTANG TEAM "<<endl;
- cout<<"\t\t\t 4. TENTANG PROGRAM "<<endl<<endl;
- cout<<"\t\t\t <<--------------------------->>"<<endl;
- cout<<"Masukkan pilihan anda : ";
- cin>>pilih;
- switch(pilih){
- case 1:
- clrscr();
- cout<<"\t\t Masukkan No pol (max 4digit) \t: ";gets(nopol1);
- cout<<"\t\t Masukkan warna mobil \t\t: ";
- cin>>warna1;
- cout<<endl;
- cout<<"--------------------------------------------------------------------------------"<<endl;
- cout<<"\t\t Masuk jam \t\t\t: ";cin>>J1hh;
- if(J1hh>24){
- cout<<"jam tidak valid";}
- cout<<"\t\t Masukkan menit \t\t: ";cin>>J1mm;
- if(J1mm>59){
- cout<<"menit tidak valid";}
- cout<<"\t\t Masukkan detik \t\t: ";cin>>J1ss;
- if(J1ss>59){
- cout<<"detik tidak valid";}
- cout<<endl;
- cout<<endl;
- cout<<"\t Mobil dengan plat *"<<nopol1<<"* Masuk parkir pada = "<<J1hh<<":"<<J1mm<<":"<<J1ss<<endl;
- cout<<"==============================================================================="<<endl;
- break;
- case 2:
- clrscr();
- cout<<"\t\t Masukkan No pol (max 4digit) \t: ";gets(nopol2);
- cout<<"\t\t Masukkan warna mobil \t\t: ";
- cin>>warna2;
- cout<<endl;
- cout<<"--------------------------------------------------------------------------------"<<endl;
- cout<<"\t\t Keluar jam \t\t\t: ";cin>>J2hh;
- if(J2hh>24){
- cout<<"jam tidak valid";}
- cout<<"\t\t Masukkan menit \t\t: ";cin>>J2mm;
- if(J2mm>59) {
- cout<<"menit tidak valid";}
- cout<<"\t\t Masukkan detik \t\t: ";cin>>J2ss;
- if(J2ss>59) {
- cout<<"detik tidak valid";}
- cout<<endl;
- cout<<"\t\t Mobil dengan plat *"<<nopol2<<"* Keluar parkir pada = "<<J2hh<<":"<<J2mm<<":"<<J2ss<<endl;
- cout<<"==============================================================================="<<endl;
- if(nopol1!=nopol2 && warna1!=warna2){
- cout<<"Mobil dengan plat *"<<nopol2<<"* tidak terdaftar"<<endl;
- break;}
- totaldetik1=(J1hh*3600)+(J1mm*60)+J1ss;
- totaldetik2=(J2hh*3600)+(J2mm*60)+J2ss;
- selisihdetik=totaldetik2-totaldetik1;
- J3hh=selisihdetik/3600;
- sisa=selisihdetik%3600;
- J3mm=sisa/60;
- J3ss=sisa%60;
- if(J3hh<2){
- bayar_parkir=1000;}
- else if (J3hh<=4){
- bayar_parkir=2000;}
- else if(J3hh<=6){
- bayar_parkir=4000;}
- else{
- bayar_parkir=5000;}
- cout<<"Mobil dengan plat *"<<nopol1<<"* parkir selama = "<<J3hh<<":"<<J3mm<<":"<<J3ss<<endl;
- cout<<"TARIF PARKIR :Rp. "<<bayar_parkir<<endl;
- cout<<"==============================================================================="<<endl;
- break;
- case 3:
- clrscr();
- cout<<"\t\t ----- Program ini dibuat oleh -----\t"<<endl;
- cout<<"\t\t\t 1. Buyung azmi (xx.xx.xxxx)"<<endl;
- cout<<"\t\t\t 2. Buyung azmi (xx.xx.xxxx)"<<endl;
- cout<<"\t\t\t 3. Buyung azmi (xx.xx.xxxx)"<<endl;
- cout<<"\t\t\t 4. Buyung azmi (xx.xx.xxxx)"<<endl<<endl;
- cout<<"==============================================================================="<<endl;
- break;
- case 4:
- clrscr();
- cout<<"\t\t ----- -----\t"<<endl;
- cout<<"\t\t\t program parkir manual ini menggunakan switch case ,gettime,getdate"<<endl;
- cout<<"\t\t\t dan program ini untuk pembayarannya sendiri jika kurang dari 2jam akan bayar Rp.1000"<<endl;
- cout<<"\t\t\t dan berlaku untuk keliapatan jam serta uang bayar juga"<<endl;
- cout<<"\t\t\t sekian dan terimakasih"<<endl<<endl;
- cout<<"==============================================================================="<<endl;
- break;
- default:
- cout<<"maaf yang anda masukkan salah silakan coba kembali";
- }
- cout<<"\n Apakah anda ingin mengulanginya ? (y/n)";cin>>key;
- }while(key=='y');
- clrscr();
- cout<<"==============================================================================="<<endl<<endl;
- cout<<"\t\t TERIMA KASIH TELAH MENGGUNAKAN PROGRAM KAMI"<<endl<<endl;
- cout<<"==============================================================================="<<endl;
- cout<<"\t\t * * * * * * * * * * * * * * * * * \n";
- cout<<"\t\t # # # # # # # # # # # \n";
- cout<<"\t\t * * * * * * * * * * * * * * * * * \n\n";
- cout<<"\t\t\t *>Date = "<<tanggal<<endl;
- cout<<"\t\t\t *>Time = "<<waktu<<endl<<endl;
- cout<<"\t\t * * * * * * * * * * * * * * * * * \n";
- cout<<"\t\t # # # # # # # # # # # \n";
- cout<<"\t\t * * * * * * * * * * * * * * * * * \n";
- cout<<"\n\t\t Please Press Any Keys ............";
- getch();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement