Jumat, 02 November 2012

-BSI- Jawaban Quiz Algoritma Pemrograman 12.1L.13

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

grs()
{cout<<"===============================================================";}


main()
{
char np[30], kf[5], *jf, lagi, a;
int ls, hs, ttl, pt, tb;

atas:
clrscr();
grs();
cout<<endl;
cout<<"                 RENTAL FILM *BSI RENTAL*       "<<endl;
grs();
cout<<endl;
cout<<"Kode Film : Judul Film            : Harga"<<endl;
grs();
cout<<endl;
cout<<"D-AAC     : Ayat-ayat Cinta       : Rp. 15.000 "<<endl;
cout<<"H-HSM     : Hantu Setan Manggarai : Rp. 12.500 "<<endl;
cout<<"A-JBO     : James Bond            : Rp. 12.000 "<<endl;
cout<<"K-DPU     : Drop Out              : Rp. 10.000 "<<endl;
cout<<"A-KPD     : Kungfu Panda          : Rp.  8.500 "<<endl;
grs();
cout<<endl;
grs();
cout<<endl;
cout<<"                 RENTAL FILM *BSI RENTAL*       "<<endl;
grs();
cout<<endl;
cout<<"Nama Penyewa    : ";cin>>np;
cout<<"Kode Film       : ";cin>>kf;
cout<<"Lama Sewa       : ";cin>>ls;
grs();
cout<<endl;
clrscr();
grs();
cout<<endl;
cout<<"                 STRUK PEMBAYARAN RENTAL BSI"<<endl;
grs();
cout<<endl;
cout<<"Nama Penyewa         : "<<np<<endl;
a:
if (!strcmp(kf,"D-AAC")||!strcmp(kf,"d-aac"))
   { jf="Ayat-ayat Cinta";
     hs=15000;}
else if (!strcmp(kf,"H-HSM")||!strcmp(kf,"h-hsm"))
   { jf="Hantu Setan Manggarai";
     hs=12500;}
else if (!strcmp(kf,"A-JBO")||!strcmp(kf,"a-jbo"))
   { jf="James Bond";
     hs=12000;}
else if (!strcmp(kf,"K-DPU")||!strcmp(kf,"k-dpu"))
   { jf="Drop Out";
     hs=10000;}
else if (!strcmp(kf,"A-KPD")||!strcmp(kf,"a-kpd"))
   { jf="Kungfu Panda";
     hs=8500;}
else
   {goto a;}

cout<<"Judul Film           : "<<jf<<endl;
cout<<"Lama Sewa            : "<<ls<<endl;
cout<<"Harga Sewa           : "<<hs<<endl;

ttl=ls*hs;

cout<<"Total                : "<<ttl<<endl;

if (ls>=10)
 pt=ttl*0.1;
else
 pt=0;

cout<<"Potongan             : "<<pt<<endl;

tb=ttl-pt;

cout<<"Total Bayar          : "<<tb<<endl;
grs();
cout<<endl;
cout<<"                TERIMA KASIH ATAS KUNJUNGANYA"<<endl;
grs();
cout<<endl;

cout<<"Ingin input lagi [Y/N] ? ";cin>>lagi;
if (lagi=='Y'||lagi=='y')
goto atas;
getch();
}

Tidak ada komentar:

Posting Komentar