Selamat Datang di Blog Kami , Kemoga Kami Bisa Membantu.... !!!!!


This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Rabu, 02 Desember 2015

PROGRAM DAFTAR GAJI PEGAWAI - TUGAS ALGORITMA



program Daftar_Gaji_pegawai;
{I.S. : user memasukkan NIP, nama pegawai, golongan, status dan jumlah anak}
{f.S. : menampilkan daftar gaji pegawai}
uses crt;

//kamus global
const
     max = 50;
type
    baris1 = array [1..max] of string;
    baris2 = array [1..max] of integer;
    baris3 = array [1..max] of real;
    baris4 = array [1..max] of char;
var
   NIP, Nama : baris1;
   Gol, jml_anak : baris2;
   status : baris4;
   PPN, Gaji_bersih : baris3;

function g_pokok(golongan : integer): integer;
{I.S. : golongan sudah terdefinisi}
{F.S. : menghasilkan fungsi gaji pokok}
begin
     case (golongan) of
     1 : g_pokok := 1250000;
     2 : g_pokok := 1350000;
     3 : g_pokok := 1500000;
     4 : g_pokok := 1750000;
     end; //endcase

end; //endfunction

function tunjangan(golongan,g_pokok : integer): real;
{I.S. : golongan sudah terdefinisi}
{F.S. : menghasilkan fungsi tunjangan}
begin
     case (golongan) of
     1 : tunjangan := 0.1 * g_pokok;
     2 : tunjangan := 0.125 * g_pokok;
     3 : tunjangan := 0.15 * g_pokok;
     4 : tunjangan := 0.2 * g_pokok;
     end; //endcase

end; //endfunction

function tunjangananak(status : char; anak:integer): real;
{I.S. : golongan sudah terdefinisi}
{F.S. : menghasilkan fungsi tunjangan anak}
begin
     tunjangananak:=0;
     if(status = 'M')
     then
     begin
          if (anak > 3)
          then
              tunjangananak := 3 * 150000
          else
          tunjangananak := anak * 150000;
     end
end; //endfunction

procedure isidata(var NIP, Nama : baris1);
{I.S. : user memasukkan NIP, nama pegawai, golongan, status dan jumlah anak}
{f.S. : menampilkan daftar gaji pegawai}
var
   i : integer;
   gajitotal : real;
begin
     textcolor(yellow);gotoxy(30,1) ; write ('DAFTAR GAJI PEGAWAI');
     gotoxy(1,2) ;
     textcolor(green);write ('================================================================================');
     gotoxy(1,3) ;
     textcolor(yellow);write ('|   NIP   | Nama Pegawai | Gol | Status | Anak |      PPN      |   Gaji bersih |');
     gotoxy(1,4) ;
     textcolor(green);write ('================================================================================');

     //memasukkan NIP
     i := 1;
     textcolor(yellow);
     gotoxy(1,i+4) ;
     write ('|         |              |     |        |      | Rp.           | Rp.           |');
     gotoxy(3,i+4) ; readln (NIP [i]);

     while ( NIP [i] <> 'STOP') and ( i <= max ) do
     begin
        gotoxy(13,i+4) ; readln (Nama [i]);
        gotoxy(29,i+4) ; readln (Gol [i]);
        gotoxy(36,i+4) ; readln (status [i]);
        if (status [i] = 'M') or (status [i] ='m') //menikah
        then
        begin
        gotoxy(44,i+4) ; readln (jml_anak [i]);
        end
        else
        if (status [i] = 'S') or (status [i] = 's') //single
        then
        begin
        gotoxy(44,i+4) ; write ('-');
        end;

        //menghitung gaji total
        gajitotal := g_pokok(Gol [i]) + tunjangan(Gol[i], g_pokok(Gol[i])) + tunjangananak(status[i], jml_anak[i]);

        //menghitung PPN
        PPN[i] := 0.1 * gajitotal;

        //menampilkan PPN
        gotoxy(54,i+4) ; write (PPN [i] :0:1);

        //menghitung gaji bersih
        Gaji_bersih[i] := gajitotal - PPN[i];

        //menampilkan gaji bersih
        gotoxy(70,i+4) ; write (Gaji_bersih [i] :0:1);

        //memasukkan NIP berikutnya
        i := i+1;
        gotoxy(1,i+4) ;
        write ('|         |              |     |        |      | Rp.           | Rp.           |');
        gotoxy(3,i+4) ; readln (NIP [i]);
     end; //endwhile

     //garis penutup tabel
     gotoxy(1,i+4) ;
     textcolor(green);write ('================================================================================');

end; //endprocedure


//program utama
begin
   isidata(NIP, Nama);
   readln;
end.