Program Menghitung Gaji Pegawai pada Pascal

0 Comment
uses crt;
type data=record
gol : string[3];
status : string[7];
j_anak : byte;
ta,ti,gaber,ppn:real;
gapok : longint;
id,nama:string;
end;
var d:array [1..100] of data;
p,a,b,c,e,i,f,j_anak:byte;
status : string;
gol : string[3];
ta,ti,gaber,ppn :real;
gapok : longint;
x,mau:char;
id :string[5];

procedure menu;
begin
writeln(' menu');
writeln('------------------------');
writeln(' 1.input');
writeln(' 2.edit');
writeln(' 3.hapus');
writeln(' 4.cetak');
writeln(' 5.keluar');
writeln('-----------------------');
write (' Masukkan Pilih Memu :');readln(p);
end;
procedure input;
begin
clrscr;
repeat
write('masukkan id anda :');readln(d[i].id);
if pos('1',d[i].id)=3 then
begin
d[i].gol:='1A';
end
else if pos('2',d[i].id)=3 then
begin
d[i].gol:='2B';
end
else
begin
d[i].gol:='3D';
end;
write('masukkan nama : ');readln(d[i].nama);
write('masukkan Status : ');readln(d[i].status);
write('masukkan Jumlah Anak : ');readln(d[i].j_anak);
if d[i].j_anak <= 3 then
begin
d[i].j_anak := d[i].j_anak;
end
else if d[i].j_anak > 3 then
begin
d[i].j_anak := 3;
end;
write('masih mau input [y/t]:');readln(mau);
inc(i)
until mau ='t';
end;
procedure edit;
begin
clrscr;
for a:=0 to i do
writeln(d[a].id ,' ',d[a].nama );
repeat
write('masukkan id :');readln(id);
for a:=0 to i do
begin
if (id=d[a].id) then
begin
d[a].nama:='';
write('masukkan nama:');readln(d[a].nama);
write('masukkan Status:');readln(d[a].status);
write('masukkan Jumlah Anak :');readln(d[a].j_anak);
end;
end;
write('masih mau edit [y/t]:');readln(mau);
until mau ='t';

end;
PROCEDURE hasil;
begin
for e:= 0 to i do
begin
if d[e].gol = '1A' then
begin
d[e].gapok := 750000;
end
else if d[e].gol = '2B' then
begin
d[e].gapok := 1256700;
end
else if d[e].gol = '3D' then
begin
d[e].gapok := 1669200;
end;
d[e].ti:=0.15 * d[e].gapok;
d[e].ta:=0.10 * d[e].gapok ;
d[e].ppn:=0.05 * d[e].gapok;
d[e].gaber:=d[e].gapok+d[e].ti+d[e].ta-d[e].ppn;
end;
inc(e)
end;

procedure hapus;
begin
clrscr;
for b:=0 to i do
writeln(d[b].id ,' ',d[b].nama );
repeat
write('masukkan id :');readln(id);
for b:=0 to i do
begin
if id=d[b].id then
begin
d[b].id:='';
d[b].nama:='';
d[b].gol:='';
d[b].status:='';
d[b].j_anak:=0;
d[b].gapok:=0;
d[b].ti:=0;
d[b].ta:=0;
d[b].ppn:=0;
d[b].gaber:=0;
writeln('data telah di hapus');
end;
end;
write('masih mau hapus [y/t]:');readln(mau);
until mau ='t';
end;
procedure cetak;
begin
for c := 0 to i do
clrscr;
hasil;
writeln('Perusahaan : PT.NAWAR (081158),Tbk. ');
writeln(' Jl.Merdeka No.45 ');
writeln(' Makassar_90245 ');
writeln('Tabel : Data Karyawan ');
writeln(' _____________________________________________________________________________');
writeln('| id | nama |gol| Status|nak| Gapok | T_istri | T_anak | PPn | Gaber |');
writeln('|-----------------------------------------------------------------------------');
for c:=0 to i-1 do
begin
gotoxy(1,8+c) ;writeln('|');
gotoxy(3,8+c);write( d[c].id);
gotoxy(8,8+c);write('|');
gotoxy(10,8+c);write(d[c].nama);
gotoxy(16,8+c);write('|');
gotoxy(18,8+c);write(d[c].gol );
gotoxy(20,8+c);write('|');
gotoxy(22,8+c);write( d[c].status );
gotoxy(28,8+c);write('|');
gotoxy(30,8+c);write( d[c].j_anak );
gotoxy(32,8+c);write('|');
gotoxy(34,8+c);write( d[c].gapok);
gotoxy(41,8+c);write('|');
gotoxy(43,8+c);write( d[c].ti:0:0 );
gotoxy(51,8+c);write('|');
gotoxy(53,8+c);write(d[c].ta:0:0);
gotoxy(61,8+c);write('|');
gotoxy(63,8+c);write(d[c].ppn:0:0);
gotoxy(69,8+c);write('|');
gotoxy(71,8+c);write(d[c].gaber:0:0);
gotoxy(79,8+c);writeln('|');
end;
writeln('|_____________________________________________________________________________|');
writeln
end;

begin
clrscr;
i:=0;
repeat
clrscr;
menu;
if p=1 then
input
else if p=2 then
edit
else if p=3 then
hapus
else if p=4 then
cetak
else
exit;
write('tekan x ke menu :');readln(x);
until x <>'x';
end.

0 Comment:

Posting Komentar

_Pasopati 2010 UYP™

Copyright 2011 Designing a dream come true.
Blogger Templates By:Noct.