Program Sederhana Peminjaman Mobil

ini tugas gw, membuat sebuah program rental mobil, semoga bermamfaat,

compiler menggunakan Turbo C++ 4.5

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

//starting Program
main()
{
//inputan
long int hsewa, diskon, totalsewa, totalbiaya,adm=5000;
int lama;
char nama[25], jenis[10],kode, lanjut, terakhir[50];
clrscr();
lagi:
printf(“\n”);
printf(“\t\t Rental Mobil CV. Berkah Barokah\n”);
printf(“\t==============================================\n\n”);
printf(“\t|——————————————–|\n”);
printf(“\t|Kode Mobil | Jenis Mobil | Harga Sewa/ Hari |\n”);
printf(“\t|——————————————–|\n”);
printf(“\t|     A     |  Kijang     | Rp. 300.000;     |\n”);
printf(“\t|     B     |  Pick-up    | Rp. 400.000;     |\n”);
printf(“\t|     c     |  Minibus    | Rp. 500.000;     |\n”);
printf(“\t|——————————————–|\n”);
printf(“\tNama Pelanggan=”);
gets (nama);
printf(“\tKode Mobil [A,B,C]:”);
scanf(“%s”,& kode);
printf(“\tLama Sewa:”);
scanf(“%d”, & lama);
clrscr();

//perhitunganya
if(kode==’A’||kode==’a’)
{
hsewa=300000L;
strcpy(jenis,”kijang”);
}
else     if(kode==’B’||kode==’b’)
{
hsewa=400000L;
strcpy(jenis,”pick-up”);
}
else     if(kode==’C’||kode==’c’)
{
hsewa=600000L;
strcpy(jenis,”Minibus”);
}
else
printf(“kode yang anda masukan salah\n”);

//output
printf(“\n\t====================================\n”);
printf(“\n\tNama Pelanggan=%s”,nama);
printf(“\n\t====================================\n”);
printf(“\tHarga Sewa perhari  =Rp.%ld\n”,hsewa);
printf(“\tjenis mobil         =%s\n”,jenis);
printf(“\tlama sewa           =%d hari \n”,lama);
totalsewa=lama*hsewa;
diskon=0.05*totalsewa;

printf(“\n\tTotal Harga Sewa sebesar =Rp.%ld”, totalsewa);
printf(“\n\tDiskon :Rp.%ld”,diskon);
printf(“\n\tadministrasi Rp.=%ld”,adm);

totalbiaya=(totalsewa-diskon)+adm;
printf(“\n\t————————————“);
printf(“\n\tTotal Biaya yang harus dibayar=Rp.%ld”,totalbiaya);
printf(“\n\n”);
printf(“\n\t************************************\n”);
printf(“\n\tApakah anda akan melakukan entri ulang [Y/N]”);
scanf(“%s”,&lanjut);
//looping
if (lanjut==’y’|| lanjut==’Y’)
goto lagi;
else
goto selesai;

getch();
selesai:
}

always Visit www.banjarnegaranews.com

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s