Pascal: Subtotal, Total


Buat temen2 nonreg 2011, stmik wup, yang belum sempet ngetik tugas mata kuliah struktur data…. bisa coppas dari sini…. Tapi di run belum sempurna… disempurnakan sendiri. OK.

USES WINCRT;
VAR
nama,gol,st: array [1..10] of string;
ja: array[1..10] of integer;
tmp: string;
gp, jml_dt,n,x,y: integer;
ti, ta, gb: real;
kode: string;
stgp, total: real;

BEGIN
nama[1]:=’adi’;gol[1]:=’2A’;st[1]:=’n’;ja[1]:=8;
nama[2]:=’edi’;gol[2]:=’1A’;st[2]:=’n’;ja[2]:=2;
nama[3]:=’rina’;gol[3]:=’1B’;st[3]:=’n’;ja[3]:=1;
nama[4]:=’elin’;gol[4]:=’2B’;st[4]:=’b’;ja[4]:=0;
nama[5]:=’budi’;gol[5]:=’2A’;st[5]:=’n’;ja[5]:=0;
nama[6]:=’kalam’;gol[6]:=’1B’;st[6]:=’n’;ja[6]:=3;

jml_dt:=6;
for x:=1 to jml_dt do

begin
for y:=x+1 to jml_dt do
begin
if gol[x]> gol[y] then
begin
tmp:=gol[x];gol[x]:=gol[y];gol[y]:=tmp;
tmp:=nama[x];nama[x]:=nama[y];nama[y]:=tmp;
tmp:=st[x];st[x]:=st[y];st[y]:=tmp;
n:=ja[x];ja[x]:=ja[y];ja[y]:=n;

end;
end;
end;

writeln (‘ LAPORAN DATA GAJI ‘);
writeln (‘———————————————————————‘);
writeln (‘ no nama gol st ja gp ti ta gb ‘);
writeln (‘———————————————————————‘);

stgp:=0;
total:=0;
kode:=gol[1];

for n:=1 to jml_dt do
begin
if gol[n]=’1A’ then
gp:=100
else
begin
if gol[n]=’1B’ then
gp:=200
else
if gol[n]=’2B’ then
else
gp:=300
end;
end;

if st[n]=’n’ then
ti:=0.10*gp
else
ti:=0;

if ja[n]> 3 then
ta:= 0.10*gp*ja[n];

gb:= gp+ti+ta;

if gol[n] kode then
begin

writeln (‘———————————————————————‘);
writeln (‘sub total; , stgp: 8:0’);
writeln (‘———————————————————————‘);

kode:=gol[n];
stgp:=0
end;

stgp:=stgp+gp;
total:=total+gp;

writeln (n:3,nama[n]:10,gol[n]:8,st[n]:6,ja[n]:4,gp:8:0,gb:8:0);

writeln (‘———————————————————————‘);
writeln (‘grand total: , total: 8:0’);

END.

One thought on “Pascal: Subtotal, Total

Tinggalkan Balasan

Isikan data di bawah atau klik salah satu ikon untuk log in:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s