PROGRAM TUGAS8;
{PROGRAM PERHITUNGAN PEMBELIAN JAM}
{MENGGUNAKAN TIPE DATA ARRAY DAN PROCEDURE}
{DIBUAT OLEH AYJ}
USES
WINCRT;
VAR
KD : ARRAY
[1..100] OF CHAR;
NT,MERK,PROD : ARRAY [1..100] OF STRING[20];
JML : ARRAY [1..100] OF BYTE;
PAJAK,DIS,TTL,HRG : ARRAY [1..100] OF REAL;
I,N : INTEGER;
GT : REAL;
PROCEDURE INPUT;
{SUBPROGRAM UNTUK MEMASUKAN DATA}
BEGIN
CLRSCR;
WRITELN('PROSES PEMASUKAN DATA');
WRITELN;
WRITE('JUMLAH DATA :');READLN(N);
WRITELN;
FOR
I:=1 TO N DO
BEGIN
WRITELN('DATA KE :',I);
WRITE('NAMA TOKO :');READLN(NT[I]);
WRITE('KODE JAM [G/Q/C/O]:');READLN(KD[I]);
WRITE('PRODUKSI :');READLN(PROD[I]);
WRITE('JUMLAH BELI :');READLN(JML[I]);
WRITELN;
END;
END;
PROCEDURE TAMPIL;
{SUBPROGRAM UNTUK MEMPROSES DAN MENAMPILKAN DATA}
BEGIN
CLRSCR;
WRITELN;
WRITELN(' DATA PEMBELIAN JAM');
WRITELN;
WRITELN('======================================================================');
WRITELN(' NO NAMA
KODE MERK PRODUKSI HARGA
JUMLAH PAJAK DISKON TOTAL ');
WRITELN(' TOKO JAM JAM
JAM
BELI BAYAR ');
WRITELN('======================================================================');
FOR I:=1 TO N DO
BEGIN
CASE KD[I] OF
'G','g' : MERK[I]:='GUESS';
'Q','q' : MERK[I]:='QUARTS';
'C','c' : MERK[I]:='CASIO';
'O','o' : MERK[I]:='OAKLEY';
END;
IF PROD[I]='IMPORT' THEN
BEGIN
IF MERK[I]='GUESS' THEN
HRG[I]:=120000
ELSE IF MERK[I]='QUARTS' THEN
HRG[I]:=150000
ELSE IF
MERK[I]='CASIO' THEN
HRG[I]:=1800000
ELSE IF
MERK[I]='OAKLEY' THEN
HRG[I]:=220000
END;
IF PROD[I]='LOKAL' THEN
BEGIN
IF
MERK[I]='GUESS' THEN
HRG[I]:=60000
ELSE
IF MERK[I]='QUARTS' THEN
HRG[I]:=100000
ELSE IF
MERK[I]='CASIO' THEN
HRG[I]:=1200000
ELSE IF
MERK[I]='OAKLEY' THEN
HRG[I]:=180000
END;
IF PROD[I]='IMPORT' THEN PAJAK[I]:=0.1*(HRG[I]*JML[I]) ELSE PAJAK[I]:=0;
IF JML[I]>=100 THEN DIS[I]:=0.2*(HRG[I]*JML[I]) ELSE
DIS[I]:=0;
TTL[I]:=((HRG[I]*JML[I])+PAJAK[I])-DIS[I];
WRITELN(I:2,NT[I]:9,KD[I]:3,MERK[I]:8,PROD[I]:8,HRG[I]:8:0,JML[I]:5,PAJAK[I]:9:0,DIS[I]:8:0,TTL[I]:9:0);
GT:=GT+TTL[I];
END;
WRITELN('======================================================================');
WRITELN('
GRAND TOTAL :','
',GT:11:0);
WRITELN('======================================================================');
END;
{PROGRAM UTAMA}
BEGIN
INPUT;
TAMPIL;
READLN;
END.
Tidak ada komentar:
Posting Komentar