Kabar Terbaru

Rental Mobil - Borland C++
Rental Mobil - Borland C++

#include <iostream.h>
#include <conio.h>
#include <stdio.h>



int main()
{
 char nama_sewa[20],kd_mobil,nm_mobil[10],input,supir;
 long lama,harga,jumtotal,jumbayar,total,potongan,kembalian,tarif;
 awal:
 clrscr();
 cout<<"==============================================="<<endl;
 cout<<"		SEWA MOBIL CINCAY"<<endl;
 cout<<"==============================================="<<endl;
 cout<<"|| Nama Penyewa : ";cin>>nama_sewa;
 cout<<"==============================================="<<endl;
 cout<<"***************** PILIHAN MOBIL ***************"<<endl;
 cout<<"==============================================="<<endl;
 cout<<"   NO |     MERK     	|          JENIS      "<<endl;
 cout<<"==============================================="<<endl;
 cout<<">> 1. |	Honda Jazz 	|	(Matic)		"<<endl;
 cout<<">> 2. |	Avanza		|	(Matic)		"<<endl;
 cout<<">> 3. |	Innova		|	(Manual)		"<<endl;
 cout<<">> 4. |	APV		|	(Manual)		"<<endl;
 cout<<">> 5. |	Freed		|	(Matic)		"<<endl;
 cout<<">> 6. |	Ertiga		|	(Matic)		"<<endl;
 cout<<"==============================================="<<endl;
 cout<<"|| Input Pilihan Mobil [ 1/2/3/4/5/6 ] 	: ";cin>>kd_mobil;
 cout<<"|| Tambah Supir [Y/T]			: ";cin>>supir;
 cout<<"==============================================="<<endl;
 if (kd_mobil=='1') {
     strcpy (nm_mobil,"Jazz		(Matic)");
     harga=500000;
     if (supir=='Y'||supir=='y'){
         tarif=250000;
         } else{
         tarif=0;
         }
} else if (kd_mobil=='2') {
     strcpy (nm_mobil,"Avanza	(Matic)");
     harga=500000;
     if (supir=='Y'||supir=='y'){
         tarif=250000;
         } else{
         tarif=0;
         }
} else if (kd_mobil=='3') {
     strcpy (nm_mobil,"Innova	(Manual)");
     harga=450000;
     if (supir=='Y'||supir=='y'){
         tarif=250000;
         } else{
         tarif=0;
         }
} else if (kd_mobil=='4') {
     strcpy (nm_mobil,"APV		(Manual)");
     harga=450000;
     if (supir=='Y'||supir=='y'){
         tarif=250000;
         } else{
         tarif=0;
         }
} else if (kd_mobil=='5') {
     strcpy (nm_mobil,"Freed		(Matic)");
     harga=550000;
     if (supir=='Y'||supir=='y'){
         tarif=250000;
         } else{
         tarif=0;
         }
} else if (kd_mobil=='6') {
     strcpy (nm_mobil,"Ertiga	(Matic)");
     harga=550000;
     if (supir=='Y'||supir=='y')
     {
         tarif=250000;
         } else {
         tarif=0;
         }
}

 //clrscr();
 cout<<endl;
 cout<<"==============================================="<<endl;
 cout<<"Nama Penyewa		: "<<nama_sewa<<endl;
 cout<<"Nama Mobil		: "<<nm_mobil<<endl;
 cout<<"Harga Sewa		: "<<harga<<endl;
 cout<<"Supir			: "<<tarif<<endl;
 cout<<"Lama Sewa	  	: ";cin>>lama;
 cout<<"==============================================="<<endl;
 total=lama*harga+tarif;
 cout<<"Total			: "<<total<<endl;


 if(total>=4000000)
 {
    potongan=0.05*total;
 }else if (total>=5000000)
 {
    potongan=0.1*total;
 }else {
    potongan=0;
 }

 cout<<"Potongan	  	: "<<potongan<<endl;
 cout<<"==============================================="<<endl;
 jumtotal=total-potongan;
 cout<<"Total Keseluruhan	: "<<jumtotal<<endl;
 cout<<"Uang Bayar		: ";cin>>jumbayar;
 kembalian = jumbayar-jumtotal;
 cout<<"Uang Kembalian		: "<<kembalian<<endl;
 cout<<"==============================================="<<endl;
 cout<<endl;
 cout<<"		TERIMA KASIH ^_^"<<endl;
 cout<<" Semoga Perjalanan Anda Nyaman dan Selamat Sampai Tujuan"<<endl;
 cout<<"Mau Input Lagi [Y/T] ?	: ";cin>>input;

 if(input=='Y' || input=='y')
 {
 goto awal;
 }

getche();
}

Subscribe to receive free email updates:

0 Response to "Contoh Program Sederhana Borland C++ - Rental Mobil"

Post a Comment