Program Diskon barang

hasil run diskon 

copy code strat form here: 

program diskon_belanja;
uses wincrt;

const max= 100;

type
Tbarang = recoad
   nama:string[8];
   jumlah:integer;
   harga:integer ;
   bayar: real;
end;
ttoko = array [1..max] of tbarang;

var
A:ttoko;
potongan:char;
i,n,no:integer;
bayar:real;
dis:real;
total:integer;
diskon:real;
begin
clrscr;
       write(‘Jumlah Transaksi:’);readln(n);
  clrscr;
         for i := 1 to n do
         begin
          writeln(‘Data Belanja-‘,i);
          writeln(‘————————‘);
          writeln;
          with A[i] do begin
          writeln(‘No                  :’,i);
          write  (‘Nama Barang         :’);readln(A[i].nama);
          write  (‘Jumlah              :’);readln(A[i].jumlah);
          write  (‘Harga               :’);readln(A[i].harga);
          writeln(‘——–Jenis Diskon—-‘);
          writeln(‘        1.10%’);
          writeln(‘        2.15%’);
          writeln(‘        3.20%’);
          write  (‘Jenis Diskon        :’);readln(potongan);
          writeln(‘————————–‘);
          writeln;
          end;
          case potongan of
          ‘1’:dis:=0.01;
          ‘2’:dis:=0.15;
          ‘3’:dis:=0.20;
       end;
   begin
      writeln;
      writeln(‘Data Belanjan   ‘);
      writeln(‘—————————————————————————-‘);
      writeln(‘No’,”:1, ‘Nama Barang’,”:4, ‘Jumlah’,”:5,’Harga’,”:7,’Total’,”:8,’Diskon’,”:6,’Bayar’,”:8);
      writeln(‘—————————————————————————–‘);
   for i:= 1 to n do
   with A[i] do begin
   inc(no);
      total:=jumlah*harga;
      diskon:=total*dis;
      bayar:=total-diskon;
        writeln (no,”:2,nama:1, ”:2, jumlah:12,”:2, harga:10,”:2,total:10,”:0,Diskon:12:0,bayar:12:0);
    end;
   end;

readln;
end; end.

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