facebook rss daftar isi halaman depan

Laman

Sabtu, 19 Februari 2011

pascal uas asia

program mahasiswa;
uses crt;
var
kode:array[1..20] of integer;
nama:array[1..20] of string[15];
harga:array[1..20] of integer;
jumlah:array[1..20] of integer;
kd:integer;
i,j,n,m:integer;
Ada:Boolean;
jb,op,ul:char;
total:array[1..20] of longint;

Procedure menu;
begin
Clrscr;
Writeln(' MENU PILIHAN');
Writeln('=============================');
Writeln('1. Tambah Data ');
Writeln('2. Transaksi Penjualan');
Writeln('3. Laporan');
Writeln('4. Keluar (Exit)');
writeln('=============================');
writeln;
Write('Pilihan [1..4]: ');op:=Readkey;
end;

procedure tambah;
begin
ul:='Y';
n:=0;
repeat
clrscr;
n:=n+1;
writeln(' DATA ENTRI');
writeln('======================');
write('Kode Barang = ');readln(kode[n]);
write('nama barang = ');readln(nama[n]);
write('harga satuan = ');readln(harga[n]);
writeln;
write('tekan y/n untuk lanjutkan.. : ');jb:=readkey;
until (jb<>'y');
end;

procedure tampil;
begin
clrscr;
ul:='Y';
writeln(' DATA ENTRI BARANG');
writeln('=================================================');
writeln('* kode * nama barang * harga barang satuan *');
writeln('=================================================');
for i:=1 to n do
writeln('*',kode[i]:6,'*',nama[i]:13,'*',harga[i]:22,'*' );
writeln('==================================================');
writeln;
writeln('Enter ke Menu..');
readln;
end;

procedure transaksi;
begin
jb:='Y';
ul:='Y';
clrscr;
j:=0;
m:=0;
repeat
Ada:=False;
clrscr;
j:=j+1;
write('Kode Barang = ');readln(kd);
if kd=kode[n] then

write('jumlah barang : ' );readln(jumlah[j]);
total[j]:=jumlah[i]*harga[i];
writeln;
write('tekan y/n ');jb:=readkey;

until(jb<>'y');
begin
clrscr;
writeln;
writeln(' NOTA PENJUALAN');
writeln('==========================================================');
writeln('* kode * nama barang * harga barang * jumlah * total *');
writeln('==========================================================');
for m:=1 to j do
begin
writeln('*',kode[m]:6,'*',nama[m]:13,'*',harga[m]:14,'*',jumlah[m]:9,'*',total[m]:10,'*' );
end;
writeln('==========================================================');
writeln;
writeln('Enter ke Menu..');
readln;
end;
end;

Begin
Repeat
Menu;
Case op Of
'1' : Tambah;
'2' : transaksi;
'3' : tampil;
End;
Until (ul<>'Y') Or (op='4');
readln;
End.

Tidak ada komentar:

Posting Komentar

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