koding membuat program gaji pegawai lewat qbasic
Koding untuk mencari gaji pegawai yang di tentukan dan outputnya seperti ini
CLS
DIM A(10, 10)
DIM PS(10)
DIM KU(10)
DIM PM(10)
FOR B = 1 TO 10
INPUT "Nama :"; A$(B, 1)
INPUT "No.Peg :"; A$(B, 2)
C = ASC(MID$(A$(B, 2), 1, 1))
A(B, 9) = VAL(MID$(A$(B, 2), 2, 1))
E = VAL(MID$(A$(B, 2), 3, 3))
DATA 1, 1500000
DATA 2, 2000000
DATA 3, 2500000
DATA 75,"keuangan"
DATA 80,"personalia"
DATA 77,"pemasaran"
DATA 107,"keuangan"
DATA 112, "personalia"
DATA 109, "pemasaran"
RESTORE
WHILE A(B, 9) <> A(B, 3)
READ A(B, 3), A(B, 4)
A(B, 5) = 10 * A(B, 4) / 100
A(B, 6) = A(B, 5) + A(B, 4)
WEND
WHILE C <> F
READ F, A$(B, 7)
A(B, 8) = E
WEND
NEXT B
TotTJ = A(1, 5) + A(2, 5) + A(3, 5) + A(4, 5) + A(5, 5) + A(6, 5) + A(7, 5) + A(8, 5) + A(9, 5) + A(10, 5)
TotGPK = A(1, 4) + A(2, 4) + A(3, 4) + A(4, 4) + A(5, 4) + A(6, 4) + A(7, 4) + A(8, 4) + A(9, 4) + A(10, 4)
FOR GP1 = 1 TO 10
IF ASC(MID$(A$(GP1, 2), 1, 1)) = 80 THEN
PS(GP1) = A(GP1, 6)
END IF
NEXT GP1
FOR GP2 = 1 TO 10
IF ASC(MID$(A$(GP2, 2), 1, 1)) = 112 THEN
PS(GP2) = A(GP2, 6)
END IF
NEXT GP2
FOR KU1 = 1 TO 10
IF ASC(MID$(A$(KU1, 2), 1, 1)) = 75 THEN
KU(KU1) = A(KU1, 6)
END IF
NEXT KU1
FOR KU2 = 1 TO 10
IF ASC(MID$(A$(KU2, 2), 1, 1)) = 107 THEN
KU(KU2) = A(KU2, 6)
END IF
NEXT KU2
FOR PM1 = 1 TO 10
IF ASC(MID$(A$(PM1, 2), 1, 1)) = 77 THEN
PM(PM1) = A(PM1, 6)
END IF
NEXT PM1
FOR PM2 = 1 TO 10
IF ASC(MID$(A$(PM2, 2), 1, 1)) = 109 THEN
PM(PM2) = A(PM2, 6)
END IF
NEXT PM2
PRINT TAB(35); "DAFTAR PEGAWAI"
PRINT TAB(38); "PT.FATKAI"
PRINT
PRINT "NO"; TAB(5); "NOPEG"; TAB(15); "NAMA"; TAB(30); "BAGIAN"; TAB(41); "GOL"; TAB(47); "TUNJANGAN"; TAB(58); "GAPOK"; TAB(69); "GAJI"
PRINT "--------------------------------------------------------------------------------"
FOR X = 1 TO 10
PRINT X; TAB(5); A$(X, 2); TAB(15); A$(X, 1); TAB(30); A$(X, 7); TAB(41); A(X, 9); TAB(47); A(X, 5); TAB(58); A(X, 4); TAB(69); A(X, 6)
NEXT X
PRINT "--------------------------------------------------------------------------------"
PRINT "TOTAL Tunjangan :"; TotTJ
PRINT "TOTAL Gaji Pokok :"; TotGPK
GPS = PS(1) + PS(2)
GPK = KU(1) + KU(2)
GPPM = PM(1) + PM(2)
PRINT "TOTAL GAJI Bag.Personalia :"; GPS
PRINT "TOTAL GAJI Bag.Keuangan :"; GPK
PRINT "TOTAL GAJI Bag.Pemasaran :"; GPPM
CLS
DIM A(10, 10)
DIM PS(10)
DIM KU(10)
DIM PM(10)
FOR B = 1 TO 10
INPUT "Nama :"; A$(B, 1)
INPUT "No.Peg :"; A$(B, 2)
C = ASC(MID$(A$(B, 2), 1, 1))
A(B, 9) = VAL(MID$(A$(B, 2), 2, 1))
E = VAL(MID$(A$(B, 2), 3, 3))
DATA 1, 1500000
DATA 2, 2000000
DATA 3, 2500000
DATA 75,"keuangan"
DATA 80,"personalia"
DATA 77,"pemasaran"
DATA 107,"keuangan"
DATA 112, "personalia"
DATA 109, "pemasaran"
RESTORE
WHILE A(B, 9) <> A(B, 3)
READ A(B, 3), A(B, 4)
A(B, 5) = 10 * A(B, 4) / 100
A(B, 6) = A(B, 5) + A(B, 4)
WEND
WHILE C <> F
READ F, A$(B, 7)
A(B, 8) = E
WEND
NEXT B
TotTJ = A(1, 5) + A(2, 5) + A(3, 5) + A(4, 5) + A(5, 5) + A(6, 5) + A(7, 5) + A(8, 5) + A(9, 5) + A(10, 5)
TotGPK = A(1, 4) + A(2, 4) + A(3, 4) + A(4, 4) + A(5, 4) + A(6, 4) + A(7, 4) + A(8, 4) + A(9, 4) + A(10, 4)
FOR GP1 = 1 TO 10
IF ASC(MID$(A$(GP1, 2), 1, 1)) = 80 THEN
PS(GP1) = A(GP1, 6)
END IF
NEXT GP1
FOR GP2 = 1 TO 10
IF ASC(MID$(A$(GP2, 2), 1, 1)) = 112 THEN
PS(GP2) = A(GP2, 6)
END IF
NEXT GP2
FOR KU1 = 1 TO 10
IF ASC(MID$(A$(KU1, 2), 1, 1)) = 75 THEN
KU(KU1) = A(KU1, 6)
END IF
NEXT KU1
FOR KU2 = 1 TO 10
IF ASC(MID$(A$(KU2, 2), 1, 1)) = 107 THEN
KU(KU2) = A(KU2, 6)
END IF
NEXT KU2
FOR PM1 = 1 TO 10
IF ASC(MID$(A$(PM1, 2), 1, 1)) = 77 THEN
PM(PM1) = A(PM1, 6)
END IF
NEXT PM1
FOR PM2 = 1 TO 10
IF ASC(MID$(A$(PM2, 2), 1, 1)) = 109 THEN
PM(PM2) = A(PM2, 6)
END IF
NEXT PM2
PRINT TAB(35); "DAFTAR PEGAWAI"
PRINT TAB(38); "PT.FATKAI"
PRINT "NO"; TAB(5); "NOPEG"; TAB(15); "NAMA"; TAB(30); "BAGIAN"; TAB(41); "GOL"; TAB(47); "TUNJANGAN"; TAB(58); "GAPOK"; TAB(69); "GAJI"
PRINT "--------------------------------------------------------------------------------"
FOR X = 1 TO 10
PRINT X; TAB(5); A$(X, 2); TAB(15); A$(X, 1); TAB(30); A$(X, 7); TAB(41); A(X, 9); TAB(47); A(X, 5); TAB(58); A(X, 4); TAB(69); A(X, 6)
NEXT X
PRINT "--------------------------------------------------------------------------------"
PRINT "TOTAL Tunjangan :"; TotTJ
PRINT "TOTAL Gaji Pokok :"; TotGPK
GPS = PS(1) + PS(2)
GPK = KU(1) + KU(2)
GPPM = PM(1) + PM(2)
PRINT "TOTAL GAJI Bag.Personalia :"; GPS
PRINT "TOTAL GAJI Bag.Keuangan :"; GPK
PRINT "TOTAL GAJI Bag.Pemasaran :"; GPPM
Komentar
Posting Komentar