LATIHAN
uses wincrt;
var i,n:byte;
kode:array[1..10]of char;
jml:array[1..10]of integer;
nama,jns:array[1..10]of string;
hrg,toha:array[1..10]of longint;
tp:longint;
lg:char;
label awal;
procedure output;
beginclrscr;writeln('DATA PENJUALAN');
writeln('=============================================');
writeln('No Nama Jenis Harga Jumlah Total');
writeln(' Pembeli Barang Barang Beli Harga');
writeln('=============================================');
for i:=1 to n do
begin
gotoxy(1,i+5);write(i);
gotoxy(4,i+5);write(nama[i]);
gotoxy(14,i+5);write(jns[i]);
gotoxy(25,i+5);write(hrg[i]);
gotoxy(35,i+5);write(jml[i]);
gotoxy(41,i+5);writeln(toha[i]);
end;
writeln('=============================================');
writeln(' Total Penjualan: ',tp);
end;
beginawal:clrscr;tp:=0;
write('Masukkan jumlah data: ');readln(n);
writeln;for i:=1 to n do
begin
writeln('Data ke-',i);
write('Nama pembeli : ');readln(nama[i]);
write('Kode Barang[A/B/C/D/E/F/G/H/I/J]: ');
readln(kode[i]);
if upcase(kode[i])='A' thenbeginjns[i]:='Mouse';hrg[i]:=50000;
end
else if upcase(kode[i])='B' then
begin
jns[i]:='Keyboard';hrg[i]:=28000;
end
else if upcase(kode[i])='C' then
beginjns[i]:='Monitor';hrg[i]:=1500000;
end
else if upcase(kode[i])='D' then
beginjns[i]:='Printer';hrg[i]:=2000000;
end
else if upcase(kode[i])='E' then
beginjns[i]:='Kertas A4';hrg[i]:=320000;
end
else if upcase(kode[i])='F' then
beginjns[i]:='Plas Dis';hrg[i]:=90000;
end
else if upcase(kode[i])='G' then
beginjns[i]:='Card Ridder';hrg[i]:=50000;
end
else if upcase(kode[i])='H' then
beginjns[i]:='Tinta';hrg[i]:=300000;
end
else if upcase(kode[i])='I' then
beginjns[i]:='CPU';hrg[i]:=1000000;
end
else if upcase(kode[i])='J' then
beginjns[i]:='Stabilizer';hrg[i]:=150000;
end
else
beginjns[i]:='Tidak Ada';hrg[i]:=0;
end;
write('Jumlah beli : ');readln(jml[i]);toha[i]:=hrg[i]*jml[i];tp:=tp+toha[i];
end;
output;
write('Input data lagi[Y/T]: ');readln(lg);if upcase(lg)='Y' thengoto awal;readln;
end.
Tidak ada komentar:
Posting Komentar