Bus Route Program Problem - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Bus Route Program Problem

fatti1477fatti1477 Posts: 2Member
Hi there,

I have been asked to create a bus route program.

It has CHILD ADULT OAP (returns also for all)


Here is my code currently

PROGRAM Bus;

USES WinCrt;

VAR

stops : ARRAY [1..8] of INTEGER;
child : ARRAY [1..8] of REAL;
adult : ARRAY [1..8] of REAL;
oap : ARRAY [1..8] of REAL;
date : CHAR;
LOOP : INTEGER;
ON : INTEGER;
OFF : INTEGER;
totalprice : REAL;
class : CHAR;
PRICE : REAL;


BEGIN
child[1] := 0.70;
child[2] := 0.80;
child[3] := 0.75;
child[4] := 1.10;
child[5] := 0.75;
child[6] := 1.40;
child[7] := 1.55;
child[8] := 0.50;

adult[1] := 1;
adult[2] := 1.20;
adult[3] := 1.05;
adult[4] := 1.56;
adult[5] := 1.05;
adult[6] := 1.90;
adult[7] := 2.10;
adult[8] := 0.80;

oap[1] := 0.75;
oap[2] := 0.85;
oap[3] := 0.80;
oap[4] := 1.20;
oap[5] := 0.80;
oap[6] := 1.55;
oap[7] := 1.75;
oap[8] := 0.65;



Writeln('What is todays date? ');
Readln(date);
clrscr;


FOR LOOP := 1 to 10 DO



BEGIN
Writeln('What stop are you getting on? ');
Readln(ON);

Writeln('What stop are you getting off? ');
Readln(OFF);

Writeln('Are you an Adult, Child , OAP?' ,' A, C, O? ');
Readln(class);

IF class = 'A'

THEN BEGIN

writeln('Adult');

Writeln(adult[ON] + adult[OFF] - adult[OFF])




END;


IF class = 'C' then begin

Writeln('Child');

END;

IF class = 'O'

THEN BEGIN

Writeln('OAP')

END;




END;

END.

Sign In or Register to comment.