Listing Program
program penjualan_barang;
uses wincrt;
type barang=record
kode: string[10];
nama:string[15];
banyak:integer;
harga:integer;
total:integer;
end;
type nilai=array[1..100] of barang;
var
M:nilai;
N:integer;
i:integer;
total:real;
begin
for i:=1 to 100 do
begin
M[i].kode:=' ';
M[i].nama:=' ';
M[i].banyak:=0;
M[i].harga:=0;
M[i].total:=0;
end;
writeln (' ');
writeln (' TUGAS PEMROGRAMAN ');
writeln (' ');
writeln ('> Nama : ERIK ');
writeln ('> Nim : C0955201125 ');
writeln ('> Jurusan : Teknik Informatika ');
writeln (' ');
write('Banyaknya Barang : '); readln(N);
for i:=1 to N do
begin
writeln('Barang Ke ',i,' dari ',N);
write('Nama Barang : '); readln(M[i].nama);
write('Banyak Barang : '); readln(M[i].banyak);
write('Harga Satuan : '); readln(M[i].harga);
begin
M[i].total:=M[i].harga*M[i].banyak;
total:=total+M[i].total;
writeln('');
end;
if total >= 10000 Then
M[i].kode:= '111'
else
if total >= 8000 Then
M[i].Kode:= '222'
else
if total >= 4000 Then
M[i].kode:= '333'
else
if total >= 3000 Then
M[i].kode := '444'
else
M[i].Kode := '555';
end;
clrscr;
writeln (' ');
writeln (' TUGAS PEMROGRAMAN ');
writeln (' ');
writeln('---------------------------------------------------------------------');
writeln('| DATA PENJUALAN BARANG |');
writeln('---------------------------------------------------------------------');
writeln('| No Kode Barang Nama Barang Banyak Barang Harga Satuan Total |');
writeln('---------------------------------------------------------------------');
for i:=1 to N do
writeln (i:3,M[i].kode:8,M[i].nama:13,M[i].banyak:15,M[i].harga:15,M[i].total:11);
writeln('----------------------------------------------------------------------');
writeln (' ');
writeln('Total Pembayaran: Rp',total:3:0);
end
2. Gambar Inputan Program
3. Gambar Output Program
:a: :b: :c: :d: :e: :f: :g: :h: :i:
:j: :k: :l: :m: :n: :o: :p: :q: :r:
:s: :t: :u: :v: :w: :x: :y: :z: :ab:
0 50 Kometar:
Posting Komentar