Kode Pascal Menghitung Gaji (case .. of)


Program Penggajian_Case;
{adalah program untuk menghitung gaji: CASE}

uses wincrt;

var
     no_induk: string[10];
     nama    : string[20];
     kd_status, jml_anak : integer;
     g_pokok, t_gaji, tj, tj_istri, tj_anak: real;
 
Begin
     clrscr;
     writeln(‘Sistim Perhitungan Gaji pakai CASE  :’);
     write(‘Nomor Induk Pegawai  :’); readln(no_induk);
     write(‘Nama                 :’); readln(nama);
     write(‘Gaji Pokok           :’); readln(g_pokok);
     write(‘Status Perkawinan    :’); readln(kd_status);

        case kd_status of
             1: begin  {kawin}
                   tj_istri:=0.1*g_pokok;
                   write(‘Jumlah Anak :’); readln(jml_anak);
                   tj_anak:=jml_anak*(0.05*g_pokok);
                end;

             2: begin {belum kawin}
                   tj_istri:=0;
                   tj_anak:=0;
                end;

             3: begin {cerai}
                   tj_istri:=0;
                   write(‘Jumlah Anak :’); readln(jml_anak);
                   tj_anak:=jml_anak*(0.05*g_pokok);
                end;                                               
             else begin
                  writeln(‘Status tidak ada …!;’);
             end;
        end;
        tj:=tj_istri+tj_anak;
        t_gaji:=g_pokok+tj;
        write(‘Jumlah Gaji :’,t_gaji:8:2);
        readln;
end.   

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s