Uncategorized

Contoh Pemrograman Pascal: Program Menu pada Warnet


Bahasa pemrograman pascal adalah bahasa pemrograman yang ditujukan kepada pemula, karena bahasa yang digunakan cenderung menggunakan bahasa kita sendiri dan juga sangat mudah dipahami.


Di bawah ini adalah contoh program menu yang saya buat untuk project akhir saya di semester pertama di salah satu kampus swasta di surakarta, project ini wajib untuk semua mahasiswa karna sebagai syarat untuk mengikuti UAS mata kuliah “Pemrograman I (Pascal).

Program makanan;
Uses crt;
Label balik;
var harga,kembali,tambah,total,menu,jumlah,haha,i,lama,uang:longint;
var jenis,nama,nm,hihi,y:string;
var lagi: char;
begin
balik:
clrscr;
gotoxy(25,2);
write(‘Nama Pelanggan: ‘); readln(nm);
writeln;
gotoxy(32,4);
writeln(‘—# WARNET #— ‘);
gotoxy(5,6);
writeln(‘==========================================================================’);
gotoxy(5,7);
writeln(‘No. Daftar Bilik Warnet |’);
gotoxy(5,8);
writeln(‘==========================================================================’);
gotoxy(5,10);
writeln(‘1. Mewah & ber AC |’);
gotoxy(5,11);
writeln(‘————————————————————————–‘);
gotoxy(5,12);
writeln(‘2. Menengah & ber AC |’);
gotoxy(5,13);
writeln(‘————————————————————————–‘);
gotoxy(5,14);
writeln(‘3. Biasa & tidak ber AC |’);
gotoxy(5,15);
writeln(‘————————————————————————–‘);
gotoxy(5,16);
writeln(‘4. Smoking Room ‘);
gotoxy(5,17);
writeln(‘————————————————————————–‘);
gotoxy(5,18);
writeln(‘5. KELUAR’);
gotoxy(5,20);
writeln(‘==========================================================================’);
gotoxy(45,6);
write(‘=============================’);
gotoxy(45,7);
write(‘Masukan pilihan anda: ‘);readln(menu);
gotoxy(45,8);
writeln(‘===========================’);

Case menu of
1: begin
nama:=’Mewah & ber AC’;
harga:=10000;
gotoxy(45,10);
write(‘Login (Personal/Paket): ‘); readln(jenis);
gotoxy(45,11);
writeln(‘—————————–‘);
gotoxy(45,12);
write(‘Lama Penggunaan (Jam): ‘); readln(lama);
gotoxy(45,13);
writeln(‘—————————–‘);
gotoxy(45,14);
write(‘Uang Pembayaran: ‘); readln(uang);
gotoxy(45,15);
writeln(‘==============================’);
end;
2: begin
harga:=8000;
nama:=’Menengah & ber AC’;
gotoxy(45,10);
write(‘Login (Personal/Paket): ‘); readln(jenis);
gotoxy(45,11);
writeln(‘—————————–‘);
gotoxy(45,12);
write(‘Lama Penggunaan (Jam): ‘); readln(lama);
gotoxy(45,13);
writeln(‘—————————–‘);
gotoxy(45,14);
write(‘Uang Pembayaran: ‘); readln(uang);
gotoxy(45,15);
writeln(‘==============================’);
end;
3: begin
nama:=’Biasa & tidak ber AC’;
harga:=6000;
gotoxy(45,10);
write(‘Login (Personal/Paket): ‘); readln(jenis);
gotoxy(45,11);
writeln(‘—————————–‘);
gotoxy(45,12);
write(‘Lama Penggunaan (Jam): ‘); readln(lama);
gotoxy(45,13);
writeln(‘—————————–‘);
gotoxy(45,14);
write(‘Uang Pembayaran: ‘); readln(uang);
gotoxy(45,15);
writeln(‘==============================’);
end;
4: begin
nama:=’Smoking Room’;
harga:=6000;
gotoxy(45,10);
write(‘Login (Personal/Paket): ‘); readln(jenis);
gotoxy(45,11);
writeln(‘—————————–‘);
gotoxy(45,12);
write(‘Lama Penggunaan (Jam): ‘); readln(lama);
gotoxy(45,13);
writeln(‘—————————–‘);
gotoxy(45,14);
write(‘Uang Pembayaran: ‘); readln(uang);
gotoxy(45,15);
writeln(‘==============================’);
end;
5: begin
writeln;
gotoxy(45,12);
writeln(‘ | Batal Login | ‘);readln;
end;
end;

if jenis=’Personal’ then begin
haha:=0;
hihi:=’PERSONAL’; end;

if jenis=’Paket’ then begin
if lama >2 then haha:=-2000;
if lama >4 then haha:=-3000;
if lama >6 then haha:=-5000;
hihi:=’PAKET’; end;

clrscr;
jumlah:=lama*harga;
total:=jumlah+haha;
kembali:=uang-total;

gotoxy(10,5);

if menu<=4 then
begin
writeln;
gotoxy(15,2);
writeln(‘# ========================================================= #’);
gotoxy(15,3);
writeln(‘# | PROGRAM MENU WARNET #’);
gotoxy(15,4);
writeln(‘# ========================================================= #’);
gotoxy(15,5);
writeln(‘# ========================================================= #’);
gotoxy(18,6);
writeln(‘Nama: Dedi Nugroho | Nim: xxx’);
gotoxy(18,8);
writeln(‘Dosen: ? | Mata Kuliah: Pascal’);

gotoxy(18,9);
writeln(‘========================================================’);
gotoxy(18,10);
writeln(‘ Nota Pembayaran Warnet ‘);
gotoxy(18,11);
writeln(‘========================================================’);
gotoxy(18,12);
writeln(‘Nama Pelanggan : ‘,nm,”);
gotoxy(18,13);
writeln(‘Nama Bilik : ‘,nama,’ ‘);
gotoxy(18,14);
writeln(‘Lama Penggunaan(Jam) : ‘,lama,’ Jam ‘);
gotoxy(18,15);
writeln(‘Harga : ‘,’ Rp. ‘,jumlah,”);
gotoxy(18,16);
writeln(‘Login : ‘,hihi,’ ‘);
gotoxy(18,17);
writeln(‘Total Harga : Rp. ‘,total,”);
gotoxy(18,18);
writeln(‘Uang Pembayaran : Rp. ‘,uang,”);
gotoxy(18,19);
writeln(‘Uang Kembalian : Rp. ‘,kembali,”);
gotoxy(18,20);
writeln(‘========================================================’);
writeln;
gotoxy(24,22);
write(‘ Kembali Ke Menu Utama[y/t]: ‘);
readln(lagi);
if (lagi=’y’) then goto balik;
readln;
end;
end.

Leave a Reply

Your email address will not be published. Required fields are marked *

error: Content is protected !!