{contoh program menggunakan case ...of}
{created by rico arteandy}
uses crt;
var
nik: string[9];
alt,nama: string[25];
jekel,sk,gol:char;
ja,mk:integer;
gapok:longint;
gaber,tj:real;
begin
clrscr;
writeln(' PT.ANDIKA PUTRA KERINCI');
writeln(' ------------------------');
write(' NOMOR INDUK KARYAWAN : ');readln(nik);
write(' NAMA KARYAWAN : ');readln(nama);
write(' ALAMAT : ');readln(alt);
write(' GOLONGAN : ');readln(gol);
writeln;
write(' MASA KERJA : ');readln(mk);
if (mk<5) then
begin
case gol of
'1' : gapok:=650000;
'2' : gapok:=750000;
'3' : gapok:=900000;
'4' : gapok:=1500000;
end;
end;
if mk>=5 then
begin
case gol of
'1' : gapok:=850000;
'2' : gapok:=950000;
'3' : gapok:=12500000;
'4' : gapok:=18000000;
end;
end;
write(' GAJI POKOK :',gapok:9);
writeln;
write(' JENIS KELAMIN [L/P] :');jekel:=Readkey;
writeln;
write(' STATUS KELUARGA [S/K] :');sk:=Readkey;
writeln;
case sk of
'S','s': tj :=0;
'K','s': tj :=0.15*gapok;
end;
writeln(' TUNJANGAN :',tj:9:0);
gaber:= gapok +tj;
write(' GAJI BERSIH :',gaber:9:0);
Readkey;
end.
0 komentar:
Posting Komentar