Sunday, May 1, 2011

Rekaman Varian ( record varian )

program contoh_rekaman_varian;
uses crt;
type stat = (T, P);
gaji = record
nama : string[30];
NIP  : string[10];
case statpeg : stat of
T : ( gaji : longint ); { pegawai tetap }
P : ( gajiperjam, { pegawai tidak tetap }
      jamkerja : longint );

end;


var pegawai : gaji;
totgaji : longint;
status : char;
begin
clrscr;

with pegawai do begin
write('nama pegawai : '); readln(nama);
write('NIP :');readln(NIP);
write('status pegawai ( T/P ) : ' ); readln(status);

case upcase(status) of
'T' : begin
statpeg := T;
write('Gaji :'); readln(gaji);
totgaji := gaji;
end;

'P' : begin
statpeg := P;
write('gaji per jam :'); readln(gajiperjam);
write('jamkerja :'); readln (jamkerja);
totgaji := gajiperjam * jamkerja;
end;
end;

writeln ('gaji totalnya adalah :', totgaji);
end;

readln;
end.

0 komentar:

Post a Comment

Tinggalkan Komentar Disini