facebook rss daftar isi halaman depan

Laman

Sabtu, 19 Februari 2011

pascal uas asia toko

uses crt;
var
ul,jb,op:char;
pil,pl:integer;
nama:array[1..20] of string[15];
harga:array[1..20] of integer;
tgl:array[1..20] of integer;
n,i,j,k:integer;
jumlah:array[1..20] of integer;
Ada:Boolean;
total:array[1..20] of longint;
totbayar:longint;
pli:char;

procedure menu;
begin
clrscr;
writeln('====================================');
writeln(' UAS GANJIL TA 2010/2011');
writeln('====================================');
writeln(' MASUKAN PIIHAN');
writeln('====================================');
writeln(' 1. INPUT DATA BARANG');
writeln(' 2. DAFTAR HARGA BARANG');
writeln(' 3. TRANSAKSI');
writeln('====================================');
writeln;
write('MASUKAN PILIHAN ANDA : ');readln(pil);
end;

procedure input;
begin
ul:='y';
n:=0;
repeat;
clrscr;
n:=n+1;
writeln('KODE BARANG : AA',n);
write('NAMA BARANG : ');readln(nama[n]);
write('HARGA ',nama[n],' : ');readln(harga[n]);
writeln;
write('Input Lagi (y/n) : ');readln(jb);
until (jb<>'y');
end;

procedure daftar;
begin
op:='2';
clrscr;
writeln('____________________________________________');
writeln(': KODE BARANG : NAMA BARANG : HARGA BARANG :');
writeln('____________________________________________');
for i:=1 to n do
begin
writeln(': AA',i,':',nama[i]:15,':',harga[i]:15,':');
end;
writeln('____________________________________________');
writeln;
writeln('1.Cari kode barang');
writeln('2.Kembali ke menu utama');
writeln;
write('masukan pilihan : ');readln(op);
end;

procedure cari;
var
kd:integer;
j,i:integer;
jb:char;
begin
op:='2';
jb:='y';
repeat;
clrscr;
i:=1;
write('KODE BARANG YANG DI CARI : AA');readln(kd);
clrscr;
if kd=i then
writeln('____________________________________________');
writeln(': KODE BARANG : NAMA BARANG : HARGA BARANG :');
writeln('____________________________________________');
writeln(': AA',kd,':',nama[kd]:15,':',harga[kd]:15,':');
writeln('____________________________________________');
writeln;
write('cari kode barang lagi (y/n) : ');readln(jb);
until (jb<>'y');
daftar;
end;

procedure tampil;
var
op:char;
begin
n:=0;
op:='2';
clrscr;
writeln('=============================================================');
writeln(' TOKO INOR SAJA');
writeln('=============================================================');
writeln('TANGGAL ',tgl[k]);
writeln('=============================================================');
writeln(':NO : NAMA BARANG : HARGA BARNG : JUMLAH BELI : TOTAL :');
writeln('_____________________________________________________________');
for n:=1 to k do
begin
writeln(':',n:3,':',nama[n]:13,':',harga[n]:13,':',jumlah[n]:13,':',total[n]:12,':');
totbayar:=totbayar+total[n];
end;
writeln('______________________________________________________________');
writeln(' TOTAL BAYAR Rp. ',totbayar);
writeln('==============================================================');
writeln(' MAKASIH');
writeln('==============================================================');
end;
procedure menu1;
begin
writeln;
writeln('1.hitung lagi');
writeln('2.kembali kemenu utama');
writeln;
write('masukan pilihan : ');readln(op);
end;

procedure transaksi;
var
kd:integer;
begin
clrscr;
k:=0;
op:='1';
jb:='y';
n:=1;
Ada:=False;
repeat
clrscr;
k:=k+1;
writeln('============================================');
writeln(' TOKO INOR SAJA ');
writeln('============================================');
write('tangal : ');readln(tgl[k]);

write('masukan kode barang : AA');readln(kd);
if kd=n then
begin
writeln;
writeln('nama barang : ',nama[n]);
writeln('harga barng : ',harga[n]);
write('jumlah beli : ');readln(jumlah[k]);
total[n]:=harga[n]*jumlah[k];
writeln('total : ',total[n]);
end
else
writeln('maaf data tidak ada');
writeln;
writeln;
write('hitung lagi (y/n) : ');readln(jb);
until (jb<>'y');
clrscr;
tampil;
end;

begin
repeat
menu;
case pil of
1:input;
2:begin
repeat
daftar;
if op='1' then
cari;
until (op='2') and (jb<>'y');
end;
3:begin
repeat
transaksi;
if jb='1' then
tampil;
menu1;
if op='1' then
transaksi;
tampil;
menu1;
until (op='2') ;
end;
end;
until (ul<>'y') and (op<>'2') and (op='2');
readln;
end.

Tidak ada komentar:

Posting Komentar

terimakasih aras kunjungan anda di blog mesujiraya
komentarnya saya tunggu mas bro & mbak sist