Jumat, 09 November 2012

-BSI- Jawaban UTS Algoritma Pemrograman

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

garis()
{puts("==============================================");}
grs()
{puts("===================================================================");}
main()
{

char np[30], kk, jt, *jk, lg;
long int jb, ht, th, pt, tb, ub, uk;

atas:
clrscr();

grs();
cout<<" Kode :         Judul         :            Jenis Tiket            :"<<endl;
cout<<"Konser:                       :     a     :      b    :     c     :"<<endl;
grs();
cout<<"  1   : Java Jazz Festival    : Rp  50000 : Rp  75000 : Rp 100000 :"<<endl;
cout<<"  2   : Young Diva In Concert : Rp  50000 : Rp 100000 : Rp 150000 :"<<endl;
cout<<"  3   : LA Light Indie Fest   : Rp  50000 : Rp  90000 : Rp 130000 :"<<endl;
grs();
cout<<endl;
cout<<endl;
garis();
cout<<"                JAZZY Musikindo"<<endl;
cout<<"            Penjualan Tiket Konser"<<endl;
garis();
cout<<"Nama Pembeli              : ";gets(np);
cout<<"Kode Konser [1/2/3]       : ";cin>>kk;
cout<<"Jenis Tiket"<<endl;
cout<<"a. Tribune"<<endl;
cout<<"b. VIP"<<endl;
cout<<"c. VVIP"<<endl;
cout<<"Pilih Jenis TIket [a/b/c] : ";cin>>jt;
cout<<"Jumlah Beli               : ";cin>>jb;

//input kode & Jenis
//output Judul & Harga

if(kk=='1')
 {strcpy(jk,"Java Jazz Festifal");
 if(jt=='a'||jt=='A')
   ht=50000;
 else if (jt=='b'||jt=='B')
   ht=75000;
 else
   ht=100000;}
else if(kk=='2')
 {strcpy(jk,"Young Diva In Concert");
 if(jt=='a'||jt=='A')
   ht=50000;
 else if (jt=='b'||jt=='B')
   ht=100000;
 else
   ht=150000;}
else if(kk=='3')
 {strcpy(jk,"LA Light Indie Fest");
 if(jt=='a'||jt=='A')
   ht=50000;
 else if (jt=='b'||jt=='B')
   ht=90000;
 else
   ht=130000;}
clrscr();
garis();
cout<<"                JAZZY Musikindo"<<endl;
cout<<"             Penjualan Tiket Konser"<<endl;
garis();
cout<<"Nama Pembeli     : "<<np<<endl;
cout<<"Judul Konser     : "<<jk<<endl;
cout<<"Jenis Tiket      : "<<jt<<endl;
cout<<"Harga Tiket      : Rp "<<ht<<endl;
cout<<"Jumlah Beli      : "<<jb<<" Tiket."<<endl;
garis();
th=jb*ht;
cout<<"Total Harga      :  Rp "<<th<<endl;
if(jb>=5)
 pt=th*10/100;
else
 pt=0;
cout<<"Potongan         :  Rp  "<<pt<<endl;
tb=th-pt;
cout<<"Total Bayar      :  Rp "<<tb<<endl;
garis();
cout<<"Uang Bayar       :  Rp ";cin>>ub;
uk=ub-tb;
cout<<"Uang Kembali     :  Rp  "<<uk<<endl;
garis();
cout<<"Have Fun and Enjoy The Show..."<<endl;
garis();
cout<<endl;
cout<<"Ingin Input Data Lagi [Y/T] ? ";cin>>lg;
if(lg=='y'||lg=='Y')
goto atas;
getch();
}

1 komentar: