Uses Crt;
type produk = record
kode : string [3];
jumlah : byte;
end;
Var Pil : Byte;
rproduk : array[1..10] of produk;
nama : string [20];
harga : longint;
total : longint;
i :byte;
j:byte;
Lg : char;
Procedure Input;
Begin
Writeln('Bagian Input');
begin
repeat
inc(i);
textcolor(14); textbackground(1);
clrscr;
gotoxy(30,5); write('Kode:'); readln (rproduk[i].kode);
gotoxy(30,6); write('Jumlah:'); readln (rproduk[i].jumlah);
gotoxy(20,8); write('Apakah anda ingin menginput lagi [Y/T] :'); readln(Lg);
until Lg In ['T','t'];
end;
End;
Procedure Output;
Begin
Writeln('Bagian Output');
clrscr;
gotoxy(23,4); write('Laporan Penjualan Barang Elektronik');
gotoxy(20,5); write('-------------------------------------------');
gotoxy(20,6); write('No Kode Nama Harga Jumlah Total');
gotoxy(20,7); write(' Barang Barang Barang Barang Bayar');
gotoxy(20,8); write('-------------------------------------------');
for j:=1 to i do
begin
if rproduk[j].kode ='001' then
begin
nama := 'TV'; harga:= 1000000;
end
else if rproduk[j].kode ='002' then
begin
nama := 'DVD'; harga:= 650000;
end;
total := harga * rproduk[i].jumlah;
gotoxy(20,9+j); write (j:1, rproduk[j].kode :7, nama :7, harga:12,rproduk[j].jumlah:5, total:10);
end;
gotoxy(20,10+j); write('-------------------------------------------');
End;
Begin
i:=0;
Clrscr;
Pil := 1;
Repeat
Writeln('Menu');
Writeln('1. Input Data');
Writeln('2. Output Data');
Writeln('3. Exit');
Write('Pilihan :');
Readln(Pil);
Case Pil of
1 : Input;
2 : Output;
End;
Readln;
Until (Pil = 3);
End.