In this article I would like to share with you a very simple program that I wrote a very long time ago in Turbo Pascal to compute the fare of the user.
My email address are the following jakerpomperada@gmail.com and jakerpomperada@yahoo.com.
My mobile number here in the Philippines is 09173084360.
My telephone number at home here in Bacolod City, Negros Occidental is (034) 4335675.
Program Listing
program proj;
uses crt;
var i : integer;
procedure pass;
var
status:string;
name,dest,acc:string[30];
date:integer;
begin
{repeat}
writeln('Fare Solver in Turbo Pascal');
writeln('Name');
readln(name);
writeln('Status');
read(status);
writeln('Destination');
readln(dest);
writeln('Date');
readln(date);
writeln('Accomodation');
readln(acc);
Case status of
begin
'student': begin
if acc == 'Cabin' then
begin
if dest == 'Manila' then
pay = 1500.00 * .2
else if dest = 'Cebu' then
pay = 1000.00 * .2
else if dest = 'Cagayan' then
pay = 2000.00 * .2
if dest == 'Davao' then
pay = 1800.00 * .2
else if dest = 'Zamboanga' then
pay = 2500.00 * .2
else if dest = 'Iloilo' then
pay = 300.00 * .2
else
writeln (' NOT IN SERVICE ')
end;
else if acc ='Tourist' then
begin
if dest == 'Manila' then
pay = 1200.00 * .2
else if dest = 'Cebu' then
pay = 800.00 * .2
else if dest = 'Cagayan' then
pay = 1500.00 * .2
if dest == 'Davao' then
pay = 1600.00 * .2
else if dest = 'Zamboanga' then
pay = 2000.00 * .2
else if dest = 'Iloilo' then
pay = 300.00 * .2
else
writeln (' NOT IN SERVICE ')
end;
else if acc == 'Tatami' then
begin
if dest == 'Manila' then
pay = 1000.00 * .2
else if dest = 'Cebu' then
pay =500.00 * .2
else if dest = 'Cagayan' then
pay = 1100.00 * .2
if dest == 'Davao' then
pay = 1300.00 * .2
else if dest = 'Zamboanga' then
pay = 1500.00 * .2
else if dest = 'Iloilo' then
pay = 300.00 * .2
else
writeln (' NOT IN SERVICE ')
end;
else if acc = 'Econom' then
begin
if dest == 'Manila' then
pay = 800.00 * .2
else if dest = 'Cebu' then
pay = 300.00 * .2
else if dest = 'Cagayan' then
pay = 900.00 * .2
if dest == 'Davao' then
pay = 1000.00 * .2
else if dest = 'Zamboanga' then
pay = 1000.00 * .2
else if dest = 'Iloilo' then
pay = 300.00 * .2
else
writeln (' NOT IN SERVICE ')
end;
'child': begin
if acc == 'Cabin' then
begin
if dest == 'Manila' then
pay = 1500.00 * .5
else if dest = 'Cebu' then
pay = 1000.00 * .5
else if dest = 'Cagayan' then
pay = 2000.00 * .5
if dest == 'Davao' then
pay = 1800.00 * .5
else if dest = 'Zamboanga' then
pay = 2500.00 * .5
else if dest = 'Iloilo' then
pay = 300.00 * .5
else
writeln (' NOT IN SERVICE ')
end;
else if acc ='Tourist' then
begin
if dest == 'Manila' then
pay = 1200.00 * .5
else if dest = 'Cebu' then
pay = 800.00 * .5
else if dest = 'Cagayan' then
pay = 1500.00 * .5
if dest == 'Davao' then
pay = 1600.00 * .5
else if dest = 'Zamboanga' then
pay = 2000.00 * .5
else if dest = 'Iloilo' then
pay = 300.00 * .5
else
writeln (' NOT IN SERVICE ')
end;
else if acc == 'Tatami' then
begin
if dest == 'Manila' then
pay = 1000.00 * .5
else if dest = 'Cebu' then
pay =500.00 * .5
else if dest = 'Cagayan' then
pay = 1100.00 * .5
if dest == 'Davao' then
pay = 1300.00 * .5
else if dest = 'Zamboanga' then
pay = 1500.00 * .5
else if dest = 'Iloilo' then
pay = 300.00 * .5
else
writeln (' NOT IN SERVICE ')
end;
else if acc = 'Econom' then
begin
if dest == 'Manila' then
pay = 800.00 * .5
else if dest = 'Cebu' then
pay = 300.00 * .5
else if dest = 'Cagayan' then
pay = 900.00 * .5
if dest == 'Davao' then
pay = 1000.00 * .5
else if dest = 'Zamboanga' then
pay = 1000.00 * .5
else if dest = 'Iloilo' then
pay = 300.00 * .5
else
writeln (' NOT IN SERVICE ')
end;
'Senior': begin
if acc == 'Cabin' then
begin
if dest == 'Manila' then
pay = 1500.00 * .3
else if dest = 'Cebu' then
pay = 1000.00 * .3
else if dest = 'Cagayan' then
pay = 2000.00 * .3
if dest == 'Davao' then
pay = 1800.00 * .3
else if dest = 'Zamboanga' then
pay = 2500.00 * .3
else if dest = 'Iloilo' then
pay = 300.00 * .3
else
writeln (' NOT IN SERVICE ')
end;
else if acc ='Tourist' then
begin
if dest == 'Manila' then
pay = 1200.00 * .3
else if dest = 'Cebu' then
pay = 800.00 * .3
else if dest = 'Cagayan' then
pay = 1500.00 * .3
if dest == 'Davao' then
pay = 1600.00 * .3
else if dest = 'Zamboanga' then
pay = 2000.00 * .3
else if dest = 'Iloilo' then
pay = 300.00 * .3
else
writeln (' NOT IN SERVICE ')
end;
else if acc == 'Tatami' then
begin
if dest == 'Manila' then
pay = 1000.00 * .3
else if dest = 'Cebu' then
pay =500.00 * .3
else if dest = 'Cagayan' then
pay = 1100.00 * .3
if dest == 'Davao' then
pay = 1300.00 * .3
else if dest = 'Zamboanga' then
pay = 1500.00 * .3
else if dest = 'Iloilo' then
pay = 300.00 * .3
else
writeln (' NOT IN SERVICE ')
end;
else if acc = 'Econom' then
begin
if dest == 'Manila' then
pay = 800.00 * .3
else if dest = 'Cebu' then
pay = 300.00 * .3
else if dest = 'Cagayan' then
pay = 900.00 * .3
if dest == 'Davao' then
pay = 1000.00 * .3
else if dest = 'Zamboanga' then
pay = 1000.00 * .3
else if dest = 'Iloilo' then
pay = 300.00 * .3
else
writeln (' NOT IN SERVICE ')
end;
'Regular': begin
if acc == 'Cabin' then
begin
if dest == 'Manila' then
pay = 1500.00
else if dest = 'Cebu' then
pay = 1000.00
else if dest = 'Cagayan' then
pay = 2000.00
if dest == 'Davao' then
pay = 1800.00
else if dest = 'Zamboanga' then
pay = 2500.00
else if dest = 'Iloilo' then
pay = 300.00
else
writeln (' NOT IN SERVICE ')
end;
else if acc ='Tourist' then
begin
if dest == 'Manila' then
pay = 1200.00
else if dest = 'Cebu' then
pay = 800.00
else if dest = 'Cagayan' then
pay = 1500.00
if dest == 'Davao' then
pay = 1600.00
else if dest = 'Zamboanga' then
pay = 2000.00
else if dest = 'Iloilo' then
pay = 300.00
else
writeln (' NOT IN SERVICE ')
end;
else if acc == 'Tatami' then
begin
if dest == 'Manila' then
pay = 1000.00
else if dest = 'Cebu' then
pay =500.00
else if dest = 'Cagayan' then
pay = 1100.00
if dest == 'Davao' then
pay = 1300.00
else if dest = 'Zamboanga' then
pay = 1500.00
else if dest = 'Iloilo' then
pay = 300.00
else
writeln (' NOT IN SERVICE ')
end;
else if acc = 'Econom' then
begin
if dest == 'Manila' then
pay = 800.00
else if dest = 'Cebu' then
pay = 300.00
else if dest = 'Cagayan' then
pay = 900.00
if dest == 'Davao' then
pay = 1000.00
else if dest = 'Zamboanga' then
pay = 1000.00
else if dest = 'Iloilo' then
pay = 300.00
else
writeln (' NOT IN SERVICE ')
end;
writeln('Total Payable:', pay);
readln
end;
end;
{ until keypressed == chr(27);}
{main}
begin
pass;
readln;
end.