Jumat, 03 Oktober 2008

Pengguaan case

Program tokoPD;
uses crt;
const dancowb = 10000;
dancows = 4250;
dancowk = 2100;
indob = 8500;
indos = 4000;
indok = 2025;
milob = 7750;
milos = 4000;
milok = 2200;
suprib = 9600;
supris = 5100;
suprik = 2600;
sustab = 17000;
sustas = 14500;

sustak = 8300;
ovalb = 11250;
ovals = 6500;
ovalk = 3200;
var
no : byte;
ukuran : char;
banyak : longint;
bayar : real;
begin
clrscr;
writeln('===============================================');
writeln(' P & D Toserba');
writeln('Susu yang tersedia di P & D Toserba : ');
writeln('1. Dancow');
writeln('2. Indomilk');
writeln('3. Milo');
writeln('4. Suprima');
writeln('5. Sustagen');
writeln('6. Ovaltime');
writeln('--------------------------------------');
write('No susu : '); readln(no);
write('Ukuran (b:besar,s:sedang,k:kecil) : '); readln(ukuran);
write('Banyak barang : '); readln(banyak);
case no of
1 : begin
case ukuran of
'b' : bayar:=dancowb*banyak;
's' : bayar:=dancows*banyak;
'k' : bayar:=dancowk*banyak;
else writeln('Ukuran salah !!');
end;

Download source code lengkap nya di sini.

0 komentar:

Template by : kendhin x-template.blogspot.com