Contoh Program Pascal GoToXY | Program Karyawan


Tutorial kali ini kita akan membahas algoritma pemrograman dasar menggunakan pascal yakni menampilkan gaji karyawan dengan tampilan program seperti dibawah ini :







uses crt;
var NIK:array[1..20] of string [10];
    Nk:array[1..20] of string [15];
    Gol:array[1..20] of string [20];
    JKW:array[1..20] of longint;
    JKL:array[1..20] of longint;
    ADL:char;JD,No,BR,X,TTLG,Gp,Gl:longint;
begin
ADL:='y'; JD:=1;
while(ADL='y')and(JD<=20)do
begin
clrscr;
gotoxy (25,5);write('ENTRY DATA GAJI');
gotoxy (25,6);write('---------------');
gotoxy (10,7);write('NIK                   :');readln(NIK[JD]);
gotoxy (10,8);write('Nama Karyawan         :');readln(NK[JD]);
gotoxy (10,9);write('Golongan              :');readln(Gol[JD]);
gotoxy (10,10);write('Jam Kerja Wajib      :');readln(JKW[JD]);
gotoxy (10,11);write('Jam Kerja Lembur     :');readln(JKL[JD]);
gotoxy (10,12);write('Ada Data Lagi? [Y/T] :');readln(ADL);
JD:=JD+1;
end;
clrscr;
gotoxy (25,1);write('LAPORAN DATA GAJI');
gotoxy (1,2);write('_______________________________________________________________________________');
gotoxy (1,3);write('|NO|   NIK    | Nama Karyawan |Gol| Jam  | Jam  | Gaji   |  Gaji   |  Total   |');
gotoxy (1,4);write('|  |          |               |   |Kerja |Kerja | Lembur |  Pokok  |  Gaji    |');
gotoxy (1,5);write('|  |          |               |   |Wajib |Lembur|        |         |          |');
gotoxy (1,6);write('-------------------------------------------------------------------------------');
BR:=7;
for x:=1 to JD-1 DO
begin
if Gol[x]='1' then Gp:=1000000
else if Gol[x]='2' then Gp:=1500000
else Gp:=2500000;
Gl:=JKL[x]*30000;
TTLG:=Gp+Gl;
gotoxy (1,BR);write('|',x);
gotoxy (4,BR);write('|',NIK[x]);
gotoxy (15,BR);write('|',NK[x]);
gotoxy (31,BR);write('|',Gol[x]);
gotoxy (35,BR);write('|',JKW[x]);
gotoxy (42,BR);write('|',JKL[x]);
gotoxy (49,BR);write('|',Gl);
gotoxy (58,BR);write('|',Gp);
gotoxy (68,BR);write('|',TTLG);
gotoxy (79,BR);write('|');
BR:=BR+1;
End;
gotoxy (1,BR);write('_______________________________________________________________________________');
readkey;
end.

semoga dapat membantu teman - teman dalam belajar algoritma dasar pemrograman.
untuk contoh programnya dapat anda download di sini.


EmoticonEmoticon