Pages

Minggu, 02 September 2012

Pascal Parkir dengan Case-of

program parkir;
uses wincrt;
var nopol,pil:char;
jk:string;
masuk,keluar,tarif,tb:real;
begin
clrscr;             
writeln('masukkan data kendaraan');
writeln('*******************************************************');
write('nomor polisi kendaraan     = ');readln(nopol);
write('input jam masuk            = ');readln(masuk);
write('input jam keluar           = ');readln(keluar);
writeln('pilih jenis kendaraan');
writeln('[1]mobil');
writeln('[2]motor');
write('masukkan pilihan anda = [1/2]= ');readln(pil);
case pil of
'1':begin
jk:='motor';
tarif:=500;
end;
'2':begin
jk:='mobil';
tarif:=1000;
end;
end;
writeln('jenis kendaraan        = ',jk);
writeln('tarif parkir perjamnya = Rp. ',tarif:0:0);
if jk='motor' then
begin
     tb:=(keluar-masuk)*tarif+500;
end
else
begin
     tb:=(keluar-masuk)*tarif+1000;
end;                                
writeln('total bayar            = Rp. ',tb:0:0);
writeln('********************************************************');
readln;
end.


0 komentar:

:)) ;)) ;;) :D ;) :p :(( :) :( :X =(( :-o :-/ :-* :| 8-} :)] ~x( :-t b-( :-L x( =))

Posting Komentar