Senin, 24 Oktober 2011

Program pascal Procedure

Contoh : program pascal dengan menggunakan Procedure
 
program tunjangan;
uses wincrt;
var
nm,jab,no :string;
gaj,ti,ta,tgaj:real;
stat,jmlank :integer;
procedure input;
begin
    writeln('=================================================');
    writeln('=TUGAS PERHITUNGAN GAJI DAN TUNJANGAN ANAK ISTRI=');
    writeln('=Nama :Muhammad Asrir           NIM :2010020112 =');
    writeln('=================================================');
    writeln('=  Masukkan data sesuai pada ketentuan berikut  =');
    writeln('=================================================');
    writeln('======Status=====================================');
    writeln('   1. Kawin     ');
    writeln('   2. Tidak Kawin  ');
    writeln('=================================================');
    writeln;
    writeln;
write ('nomor induk karyawan  : ');readln(no);
write ('nama pegawai          : ');readln(nm);
write ('jabatan pegawai       : ');readln(jab);
write ('Gaji pokok            : Rp,');readln(gaj);
end;
procedure pilih;
begin
write ('status perkawinan       : ');readln(stat);
case stat of
1 :begin
ti :=(15/100)*gaj;
write ('jumlah anak             : ');readln(jmlank);
if (jmlank >=3) then
ta :=(5/100)*gaj
else if (jmlank <3) then
ta :=0;
       end;
2 :begin
ti :=0;
ta :=0;
       end;
   end;
end;
procedure proses;
begin
tgaj :=gaj+ta+ti;
writeln;
    writeln('=================oO SLIP GAJI Oo=================');
    writeln;
    writeln ('Nama          : ',nm);
    writeln ('No Karyawan   : ',no);
    writeln ('Jabatan       : ',jab);
    writeln ('+===============================================+');
    writeln ('|       Rincian Gaji         |      Jumlah      |');
    writeln ('+===============================================+');
    writeln ('| Gaji Pokok               : | Rp ',gaj:8:0,'      |');
    writeln ('| Tunjangan Anak           : | Rp ',ta:8:0,'      |');
    writeln ('| Tunjangan Istri          : | Rp ',ti:8:0,'      |');
    writeln ('|                            |                  |');
    writeln ('+===============================================+');
    writeln ('| Total Gaji Bersih        : | Rp ',tgaj:8:0,'      |');
    writeln ('+===============================================+');
    readln;
end;
    begin
    input;
    pilih;
    proses;
        end.

0 komentar:

Posting Komentar

Twitter Delicious Facebook Digg Stumbleupon Favorites More