Program Simulasi Kasir dan Password © Yuni Susanti S1 Ilmu Komputer 2007 11th March University PROGRAM simulasi_kasir; USES wincrt; TYPE kasir = RECORD tgu, lyn, slsai : integer; END; X
= RECORD dtg, brg : integer; END;
VAR i,jml_brg, jml_tdtg, jml_atgu, jml_alyn, jml_aslse, jml_blyn,jml_btgu,jml_bslse : integer; plgn : ARRAY[1..3] OF x; A, B : ARRAY[1..3] OF kasir; PROCEDURE DATA; BEGIN FOR i := 1 TO 3 DO BEGIN clrscr; gotoXY( 5, 4); write(' this is H a P P Y-T R E E"S S H O P'); gotoXY( 5, 6); write(' happytree"s trademark by : yuni, x, x'); gotoXY(55,10); write('# Pelanggan Ke -',i,'-'); gotoXY(55,12); write('============================');
{MULAI MENGINPUTKAN DATA}
gotoXY(55,14); write('# jumlah barang : '); readln(plgn[i].brg); gotoXY(55,16); write('# waktu datang : '); readln(plgn[i].dtg); {MULAI KALKULASI / PENGHITUNGAN} IF plgn[i].brg <= 10 THEN {UNTUK PESANAN KURANG DARI/ SAMA DENGAN 10} BEGIN IF plgn[i].dtg >= A[i-1].slsai THEN BEGIN A[i].tgu :=0; A[i].lyn :=2*plgn[i].brg; A[i].slsai:=(plgn[i].dtg)+(A[i].lyn); END ELSE BEGIN
IF plgn[i].dtg >= B[i-1].slsai THEN BEGIN B[i].tgu :=0; B[i].lyn :=2*plgn[i].brg; B[i].slsai:=(plgn[i].dtg)+(B[i].lyn); END ELSE BEGIN
{A DAN B SAMA - SAMA SEDANG SIBUK MELAYANI}
IF A[i-1].slsai-plgn[i].dtg <= B[i-1].slsai-plgn[i].dtg THEN BEGIN A[i].tgu :=A[i-1].slsai-plgn[i].dtg; A[i].lyn :=2*plgn[i].brg; A[i].slsai:=A[i-1].slsai+A[i].lyn; END ELSE BEGIN B[i].tgu :=B[i-1].slsai-plgn[i].dtg; B[i].lyn :=2*plgn[i].brg; B[i].slsai:=B[i-1].slsai+B[i].lyn; END; END; END; END; IF plgn[i].brg>10 THEN
{UNTUK PESANAN LEBIH DARI 1O}
BEGIN IF plgn[i].dtg>=B[i-1].slsai THEN BEGIN B[i].tgu:=0; B[i].lyn:=2*plgn[i].brg; B[i].slsai:=(plgn[i].dtg)+(B[i].lyn); END ELSE BEGIN IF plgn[i].dtg>=A[i-1].slsai THEN BEGIN A[i].tgu:=0; A[i].lyn:=2*plgn[i].brg; A[i].slsai:=(plgn[i].dtg)+(A[i].lyn); END
ELSE BEGIN
{A DAN B SAMA - SAMA SEDANG SIBUK MELAYANI}
IF B[i-1].slsai-plgn[i].dtg <= A[i-1].slsai-plgn[i].dtg THEN BEGIN B[i].tgu:=B[i-1].slsai-plgn[i].dtg; B[i].lyn:=2*plgn[i].brg; B[i].slsai:=B[i-1].slsai+B[i].lyn; END ELSE BEGIN A[i].tgu:=A[i-1].slsai-plgn[i].dtg; A[i].lyn:=2*plgn[i].brg; A[i].slsai:=A[i-1].slsai+A[i].lyn; END; END; END; END; jml_brg := jml_brg + plgn[i].brg; jml_tdtg := jml_tdtg + plgn[i].dtg; jml_atgu := jml_atgu + a[i].tgu; jml_alyn := jml_alyn + a[i].lyn; jml_aslse:= jml_aslse + a[i].slsai; jml_btgu := jml_btgu + b[i].tgu; jml_blyn := jml_blyn + b[i].lyn; jml_bslse:= jml_bslse + b[i].slsai; END; END;
{END DARI FOR i} {END PROCEDURE DATA}
PROCEDURE CETAK; BEGIN clrscr; gotoXY(55,3); write('
H a P P Y-T R E E"S S H O P');
gotoXY(55,5); write(' -trademark by : Yuni, x, x'); gotoXY(55,7); write(' -customer list : D A Y XXVIII '); gotoXY(3,10); writeln('-----------------------------------------------------------------------------'); gotoXY(3,11); writeln('| PELANGGAN
|
KASIR A
|
KASIR B
|');
gotoXY(3,12); writeln('-----------------------------------------------------------------------------'); gotoXY(3,13); writeln('(no) (dtg) (brg) writeln;
(tunggu) (layani) (selesai) (tunggu) (layani) (selesai)');
FOR i := 1 TO 3 DO BEGIN Writeln(i:4,plgn[i].dtg:5,plgn[i].brg:6,A[i].tgu:12,A[i].lyn:9,A[i].slsai:9,B[i].tgu:12,B[i].lyn:9,B[i].slsai:9); END; writeln; write (' JUMLAH TOTAL BARANG : ',jml_brg); writeln('
JUMLAH TOTAL WAKTU DATANG : ',jml_tdtg); writeln;
write (' press -enter- untuk mengetahui rincian per-kasir..
'); readln;
clrscr; gotoXY(14, 6); writeln('"Rincian Kasir A"'); gotoXY(10, 8); writeln('# total waktu tunggu
= ',jml_atgu);
gotoXY(10,10); writeln('# total waktu layanan
= ',jml_alyn);
gotoXY(10,12); writeln('# total waktu selesai
= ',jml_aslse); writeln;
gotoXY(14,15); writeln('"Rincian Kasir B"'); gotoXY(10,17); writeln('# total waktu tunggu
= ',jml_btgu);
gotoXY(10,19); writeln('# total waktu layanan
= ',jml_blyn);
gotoXY(10,21); writeln('# total waktu selesai
= ',jml_bslse);
gotoXY(14,24); write ('press any key for exit program !!
'); readkey; donewincrt;
END; {END PROCEDURE CETAK} BEGIN {MAIN PROGRAM} screensize.x := 100;
{MENGATUR LEBAR TAMPILAN HORIZONTAL/ X}
screensize.y := 100;
{MENGATUR LEBAR TAMPILAN VERTIKAL/ Y}
data;
{MEMANGGIL PROCEDURE DATA UNTUK INPUT DAN KALKULASI DATA}
cetak;
{MEMANGGIL PROCEDURE CETAK UNTUK MENAMPILKAN HASIL}
END. {END OF PROGRAM}
PROGRAM simulasi_pasword; USES wincrt; VAR user, psw1, pEnkrip, pDekrip : STRING; i : integer; PROCEDURE menu; FORWARD; PROCEDURE password; VAR p : char; BEGIN REPEAT p := readkey; IF p <> #13 THEN BEGIN write('*'); psw1 := psw1 + p; END; UNTIL p=#13; END; PROCEDURE enkripsi; BEGIN pEnkrip := psw1; FOR i := 1 TO length(psw1) do pEnkrip[i] := chr(ord(psw1[i])+5); END; PROCEDURE dekripsi; BEGIN pDekrip := pEnkrip; FOR i := 1 TO length(pEnkrip) do pDekrip[i] := chr(ord(pEnkrip[i])-5); END; PROCEDURE inputdantampil; BEGIN clrscr; gotoXY(12,6); write(' # User Name gotoXY(12,8); write(' # Password
!! !!
'); readln(user); '); password;
clrscr; gotoXY(20,6); write(' # Press Enter To Encrypt Your Password !! '); readln; enkripsi; gotoXY(25,8); write(' Password Setelah di Enkrip = ',pEnkrip); gotoXY(20,11); write(' # Press Enter To Decrypt Your Password !! '); readln;
gotoXY(25,13); write(' User Name = ',user); dekripsi; gotoXY(25,15); write(' Password = ',pDekrip); gotoXY(20,18); write(' # Press Enter To Back To Menu !! '); readln; menu; END; PROCEDURE identitas; BEGIN clrscr; gotoXY(12, 8); write(' This Program Was Created By : '); gotoXY(10,10); write('Name : Yuni Susanti'); gotoXY(10,12); write('NIM : M0507054'); gotoXY(10,14); write('Title : Password Simulation :) '); gotoXY(10,16); write('Date : 8th June 2008'); gotoXY(12,20); write('Press Enter To Return To The Menu !! '); readln; menu; END; PROCEDURE menu; VAR pil : char; BEGIN clrscr; gotoXY(12, 6); write('Menu Pada Program Kali Ini'); gotoXY(20,10); write(' a. Identitas Pembuat'); gotoXY(20,12); write(' b. Mulai Password Enkripsi '); gotoXY(20,14); write(' c. Keluar Program'); gotoXY(12,18); write(' Silahkan Pilih !! '); readln(pil); CASE pil OF 'a','A' : identitas; 'b','B' : inputdantampil; 'c','C' : BEGIN clrscr; gotoXY(13, 8); write(' Terima Kasih Telah Menggunakan Program Ini Ya :)'); gotoXY(13,12); write(' Tekan Anykey Untuk Exit Window.. '); readkey; donewincrt; END; END; END; BEGIN
screensize.x := 100; screensize.y := 200; menu; END.