program gunawan;
uses wincrt;
type
swl=record
nama:string;
hrg:longint;
jml:longint;
tot:longint;
end;
var
swa:array[1..100] of swl;
totsem,disk,total:real;
i,n:integer;
begin
writeln('SELAMAT DATANG DI SWALAYAN SAYA');
writeln;
write('Berapa barang yang anda beli ? : ');readln(n);
writeln;
for i:=1 to n do
begin
with swa[i] do
begin
write(i,' Nama Barang : ');readln(nama);
write(' Harga Barang : ');readln(hrg);
write(' Jumlah Barang : ');readln(jml);
tot:=hrg*jml;
end;
writeln;
end;
writeln;
writeln('STRUK PEMBELIAN');
writeln;
writeln('No Nama Barang Harga Barang Jumlah Total Harga');
for i:=1 to n do
begin
with swa[i] do
begin
writeln(i:2,nama:13,hrg:14,jml:8,tot:13);
end;
end;
totsem:=0;
for i:=1 to n do
begin
totsem:=totsem+swa[i].tot;
end;
writeln('jadi total pembayaran adalah Rp ',totsem:0:2);
if (totsem>150000) then
begin
disk:=totsem/10;
total:=totsem-disk;
writeln('anda mendapat diskon Rp ',disk:0:2);
writeln('jadi total yg harus dibayar Rp ',total:0:2);
end;
if (totsem<=150000) then
begin
writeln('maaf anda belum mendapat diskon');
writeln('jadi tetap membayar Rp ',totsem);
end;
end.
Thursday, 3 July 2014
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment