Contoh Program Aplikasi Pascal [Fungsi IF]

BERIKUT KODE PROGRAMNYA

program Warni_Buulolo;
uses crt;
var
KodeRute, JumlahPenumpang : integer;
Rute : String;
THargaTiket, HargaTiket : Real;

begin
clrscr;
writeln('===================================');
writeln('==== KODE INPUT ======');
writeln('===================================');

write(' Masukan Kode Rute : '); readln(KodeRute);
 write(' Masukan Jumlah Penumpang : '); readln(JumlahPenumpang);

if (KodeRute = 11) then
begin
 Rute := 'Medan - Jakarta';
 HargaTiket :=350000;
end
else if (KodeRute = 12) then
begin
 Rute := 'Cirebon - Cianjur';
 HargaTiket := 150000;
end
else if (KodeRute = 13) then
begin
 Rute := 'Pekan Baru - Padang';
 HargaTiket := 220000;
end;

THargaTiket := JumlahPenumpang * HargaTiket;
 writeln(' Total Harga Tiket :', THargaTiket:0:2);
writeln('===================================');
 writeln('');
 writeln(' Cetak Laporan ');
 writeln('');
 
writeln('===================================');
writeln('==== KODE OUTPUT ======');
writeln('===================================');

writeln(' Kode Rute : ', KodeRute);
 writeln(' Rute : ', Rute);
 writeln(' Harga Tiket : ', HargaTiket:0:2);
 writeln(' Jumlah Penumpang : ', JumlahPenumpang);
 writeln(' Total Harga Tiket : ', THargaTiket:0:2);
writeln('===================================');
readln;

end.

Download Bentuk File *.Pas

File *.Pas yang anda download anda bisa buka dengan menggunakan aplikasi Notepad yang ada pada Application Sistem Operasi Anda.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s