Minggu, 16 Desember 2012

ALGORITMA "DISKON BARANG"


program toko;
uses crt;

var
a : string;
b : longint;
c : integer;
JP,DPB,TD,JDB : real;



begin
      clrscr;
      writeln('               ======================');
      writeln('               ====   Eko shop   ====');
      writeln('               ======================');
      writeln;
      write(' Ketik Nama Barang    = '); readln(a);
      write(' Ketik Harga Barang   = Rp. '); readln(b);
      write(' Ketik Jumlah Barang  = '); readln(c);
      writeln;

      writeln('---------------------------------------------');
      JP := c*b;
      write(' Jumlah Pembelian ',a,'              = Rp. ',JP:0:2);
      writeln;
      writeln('----------------------------------------------');

 if b>200000 then DPB := 0.5 * b
 else
 if b>50000 then DPB := 0.5 * b
 else
 if b>10000 then DPB := 0.05 *b
 else writeln;
 writeln(' Jumlah Diskon Persatuan Barang        = Rp. ',DPB:0:2);
 writeln('--------------------------------------------------------');
 TD := DPB * c;
 writeln(' Jumlah Total Diskon                   = Rp. ',TD:0:2);
 writeln('--------------------------------------------------------');

 writeln;
 writeln('--------------------------------------------------------');
 JDB := JP - TD;
 writeln(' Jumlah Uang yang Harus di Bayarkan    = Rp. ', JDB:0:2);
 writeln('--------------------------------------------------------');

 readln;
end.

ARTIKEL TERKAIT:

Tidak ada komentar: