Mesran

Hanya ingin berbagi kebaikan dan mendapatkan kebaikan yang lain.

Jawaban UTS : Type B Pemrograman Terstruktur PASCAL

Berikut ini merupakan jawaban ujian pemrograman terstruktur untuk PASCAL type B.

Silahlah di pelajari  :D

uses crt ;
type Pegawai = record
     NIP  : String[15] ;
     Nama : String[30] ;
     Gol  : String[4] ;
     Jabat: String[5] ;
     end;

var
   rpeg : array[1..50] of Pegawai ;
   i, j : byte ;
   gaji,
   total,
   tunj : longint ;
   lg   : Char ;
   pil  :  byte;


   Procedure MenuPegawai ;
   Begin
        clrscr ;
        Gotoxy(5,09) ; write ('-----------------------');
        Gotoxy(5,10) ; write ('      Menu Utama ');
        Gotoxy(5,11) ; write ('-----------------------');
        Gotoxy(5,12) ; write ('1. Input Data Pegawai');
        Gotoxy(5,13) ; write ('2. Output Data Pegawai');
        Gotoxy(5,14) ; write ('3. Keluar Program');
        Gotoxy(5,15) ; write ('-----------------------');
        Gotoxy(5,16) ; write ('Pilihan Anda : ');
        Readln (Pil) ;

   end;

   Procedure InputPegawai ;
   Begin
        repeat
           inc(i) ;
           with rpeg[i] do
           begin
             clrscr ;
             Gotoxy(5,09) ; write ('-----------------------');
             Gotoxy(5,10) ; write ('Input Data Pegawai');
             Gotoxy(5,11) ; write ('-----------------------');
             Gotoxy(5,12) ; write ('NIP     :'); readln(NIP) ;
             Gotoxy(5,13) ; write ('Nama    :'); readln(Nama) ;
             Gotoxy(5,14) ; write ('Gol     :'); readln(Gol) ;
             Gotoxy(5,15) ; write ('Jabatan :'); readln(Jabat) ;
             Gotoxy(5,16) ; write ('-----------------------');
             Gotoxy(5,17) ; write ('Input Data Lagi[Y/T]:'); Readln(lg) ;
           end;
        until upcase(lg)='T' ;
   End;

   Procedure OutputPegawai ;
   Begin
        clrscr ;
        Gotoxy(5, 2) ; write ('------------------------------------------------------------------------');
        Gotoxy(5, 3) ; write (' No  NIP    Nama Pegawai    Gol    Gaji   Jabatan   Tunjangan Total Gaji');
        Gotoxy(5, 4) ; write ('------------------------------------------------------------------------');
        for j:=1 to i do
        begin

             with rpeg[j] do
             begin
                  if gol='IIIA' then gaji := 1000000
                  else if gol='IIIB' then gaji := 1500000
                  else if gol='IIIC' then gaji := 2000000
                  else if gol='IIID' then gaji := 3000000 ;

                  if jabat ='KaBag' then Tunj := 900000
                  else if jabat ='KaSub' then Tunj := 450000 ;

                  total := gaji + tunj ;
                  gotoxy(5 ,4+j) ; write(j:2, NIP:8,'  ', Nama) ;
                  gotoxy(34,4+j) ; write(Gol:3,'  ', Gaji:9) ;
                  gotoxy(50,4+j) ; write(Jabat) ;
                  gotoxy(60,4+j) ; write(Tunj) ;
                  gotoxy(70,4+j) ; write(Total) ;

             end;
        end;
        Gotoxy(5, 5+j) ; write ('------------------------------------------------------------------------');
        readln;
   end;


begin
     i :=0 ;
     pil:=1 ;
     while pil<>3 do
     begin
          MenuPegawai ;
          case pil of
          1 : inputPegawai  ;
          2 : outputPegawai ;
          end ;

     end;
end.

Hasilnya :


Filed under: Pemrograman Pascal, Ujian, ,

Terima kasih telah memberikan komentar anda.

Fill in your details below or click an icon to log in:

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

Archives Per Tahun

Sponsored

C&C Online Shop

Blog Stats

  • 355,909 sejak 12 Jan 2011

User’s Online


My Music

Enter your email address to follow this blog and receive notifications of new posts by email.

Join 223 other followers

May 2011
M T W T F S S
« Apr   Jun »
 1
2345678
9101112131415
16171819202122
23242526272829
3031  
%d bloggers like this: