Fiddy's Room

LATIHAN UTS

LATIHAN PRA UTS

PASCAL

Input:

===============================

Toko Bunga Harum Sari

——————————-

Nama Pembeli :

Kode Bunga [1/2] :

Jasa Pengiriman [A/B] :

Jumlah Beli :

——————————–

Output:

===============================

Toko Bunga Harum Sari

——————————-

Nama Pembeli :

Nama Bunga :

Harga :

Jumlah Beli :

Jenis Pengiriman:

Biaya Kirim :

Total Bayar :

Bonusnya :

——————————-

Ketentuan Soal:

1. Kode Bunga

Kode Bunga

Nama Bunga

Harga

1

Anggrek

15.000

2

Melati

10.000

2. Kode Jasa

Kode Jasa

Jasa

Biaya Kirim

A

Kurir

25.000

B

POS

5.000

3. Total Bayar = harga*jubel;

4. Bonus :

Total Bayar

Jasa

Bonus

>=250.000

Kurir

1 Pot Bunga

POS

10 Tangkai Bunga

>=150.000

Kurir

5 Tangkai Bunga

POS

2 Tangkai Bunga

Selain itu

Kurir

No Bonus

POS

Listing Program:

program latihan;

uses crt;

var

nama,bonus,jasa,bunga:string[25];

kobu,koja,A,B,Y,N,input:char;

jubel:longint;

totbay,harga,bikir:longint;

label awal,akhir;

begin

clrscr;

awal:

writeln(‘===============================’);

writeln(‘ Toko Bunga Harum Sari ‘);

writeln(‘——————————-‘);

writeln;

write(‘Nama Pembeli : ‘);readln(nama);

write(‘Kode Bunga [1/2] : ‘);readln(kobu);

write(‘Jasa Pengiriman [A/B] : ‘);readln(koja);

write(‘Jumlah Beli : ‘);readln(jubel);

if kobu=’1′ then

begin

bunga:=’Anggrek’;

harga:=15000;

end

else

begin

bunga:=’Melati’;

harga:=10000;

end;

totbay:=jubel*harga;

if (koja=’A’) or (koja=’a’) then

begin

jasa:=’Kurir’;

bikir:=25000;

end

else

begin

jasa:=’Pos’;

bikir:=5000;

end;

if totbay>=250000 then

begin

if (koja=’A’) or (koja=’a’) then

begin

bonus:=’1 Pot Bunga’;

end

else

begin

bonus:=’10 Tangkai’;

end;

end

else

if totbay>=150000 then

begin

if (koja=’A’) or (koja=’a’) then

begin

bonus:=’5 Tangkai Bunga’;

end

else

begin

bonus:=’2 Tangkai Bunga’;

end;

end

else

begin

bonus:=’No Bonus’;

end;

clrscr;

writeln(‘===============================’);

writeln(‘ Toko Bunga Harum Sari ‘);

writeln(‘——————————-‘);

writeln;

writeln(‘Nama Pembeli : ‘,nama);

writeln(‘Nama Bunga : ‘,bunga);

writeln(‘Harga : ‘,harga);

writeln(‘Jumlah Beli : ‘,jubel);

writeln(‘Jenis Pengiriman: ‘,jasa);

writeln(‘Biaya Kirim : ‘,bikir);

totbay:=harga*jubel;

writeln(‘Total Bayar : ‘,totbay);

writeln(‘Bonusnya : ‘,bonus);

writeln;

write(‘Mau Input data lagi? [Y/N] : ‘);readln(input);

clrscr;

if (input=’Y’) or (input=’y’) then

goto awal

else

goto akhir;

readln;

akhir:

end.

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: