--------------------------------------------------------------------------------------------------------------------------
program Tunjangan_gaji;{I.S : User memasukan array NIP,Nama,Gol,Status, dan jml anak}
{F.S : Menampilkan daftar gaji total pegawai}
uses crt;
const
maks_peg = 5;
Type
Larik1 = array [1..maks_peg] of string;
Larik2 = array [1..maks_peg] of integer;
Larik3 = array [1..maks_peg] of real;
var
NIP,nama,status : Larik1;
Gol,Jumanak : Larik2;
PPN,Gatot,Gaji : Larik3;
function GajiPokok (Gol : integer): integer;
{I.S : Golongan sudah terdefinisi}
{F.S : Menghasilkan fungsi gaji pokok}
Begin
case (Gol) of
1 : GajiPokok := 1250000;
2 : GajiPokok := 1350000;
3 : GajiPokok := 1500000;
4 : GajiPokok := 1750000;
end; // end case
end; // end function
function Tunjangan (Gol,Gapok : integer): real;
{I.S : Golongan dan Gaji pokok sudah terdefinisi}
{F.S : Menghasilkan fungsi Tunjangan}
Begin
case (Gol) of
1 : Tunjangan := 0.1 * Gapok;
2 : Tunjangan := 0.125 * Gapok;
3 : Tunjangan := 0.15 * Gapok;
4 : Tunjangan := 0.2 * Gapok;
end; // end case
end; // end function
function Tunjangananak (status : string; Jumanak,Gol : integer): real;
{I.S : Status dan jumlah anak sudah terdefinisi}
{F.S : Menghasilkan harga tunjangan dari status,jumlah anak , dan gaji pokok}
Begin
case (Gol) of
1 : if (status = 'M') and (Jumanak >= 3 )
then
begin
Jumanak := 3;
Tunjangananak := Jumanak *150000;
end
else
if (status = 'M') and (Jumanak > 0 ) and (Jumanak <= 3 )
then
begin
Tunjangananak := Jumanak * 150000;
end;
2 : if (status = 'M') and (Jumanak >= 3 )
then
begin
Jumanak := 3;
Tunjangananak := Jumanak *150000;
end
else
if (status = 'M') and (Jumanak > 0 ) and (Jumanak <= 3 )
then
begin
Tunjangananak := Jumanak * 150000;
end;
3 : if (status = 'M') and (Jumanak >= 3 )
then
begin
Jumanak := 3;
Tunjangananak := Jumanak *150000;
end
else
if (status = 'M') and (Jumanak > 0 ) and (Jumanak <= 3 )
then
begin
Tunjangananak := Jumanak * 150000;
end;
4 : if (status = 'M') and (Jumanak >= 3 )
then
begin
Jumanak := 3;
Tunjangananak := Jumanak *150000;
end
else
if (status = 'M') and (Jumanak > 0 ) and (Jumanak <= 3 )
then
begin
Tunjangananak := Jumanak * 150000;
end;
end; //endcase
end; // end function
Procedure Isidata (var Gol,Jumanak : Larik2; var status : Larik1);
{I.S : User memasukan array NIP,Nama,Golongan,Status, dan jumlah anak}
{F.S : Menampilkan daftar gaji total pegawai}
var
i,Gapok : integer;
begin
// membuat tabel
gotoxy (28,1);
write ('DAFTAR GAJI TOTAL PEGAWAI');
gotoxy (1,2);
write ('--------------------------------------------------------------------------------');
gotoxy (1,3);
write ('| NIP | Nama | Gol | Status | Anak | PPN | Gaji Total |');
gotoxy (1,4);
write ('--------------------------------------------------------------------------------');
//memasukan data
i := 1;
gotoxy (1,i+4);
write ('| | | | | | Rp. | Rp. |');
gotoxy (3,i+4); readln(NIP[i]);
while (NIP[i] <> 'stop') do
begin
gotoxy (15,i+4); readln(nama[i]);
gotoxy (29,i+4); readln(Gol[i]);
gotoxy (36,i+4); readln(status[i]);
if (status[i]='M')
then
begin
gotoxy (44,i+4); readln(jumanak[i]);
end
else
begin
gotoxy (44,i+4); write ('-');
end;
// Menghitung gaji total dan ppn
Gapok := GajiPokok(Gol[i]);
Gatot[i] := Gapok + Tunjangan(Gol[i],Gapok)+Tunjangananak(status[i],Jumanak[i],Gol[i]);
PPN[i] := 0.1 * Gatot[i];
Gatot[i] := Gatot[i] - PPN[i];
// Menampilkan PPN dan gaji total
gotoxy (54,i+4); write(PPN[i]:0:1);
gotoxy (69,i+4); write(Gatot[i]:0:1);
// Memasukan data berikutnya
i := i+1;
gotoxy (1,i+4);
write ('| | | | | | Rp. | Rp. |');
gotoxy (3,i+4); readln(NIP[i]);
end; // end while
gotoxy (1,i+4);
write ('--------------------------------------------------------------------------------');
end; // end procedure
// Program utama
begin
Isidata (Gol,Jumanak,status);
readln;
end.
--------------------------------------------------------------------------------------------------------------------------
Download Scriptnya :
catatan :
hargailah tulisan orang lain, jika anda mengcopy-paste harap cantumkan link sumber.
0 komentar