Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4095
Number of posts: 14004

This Forum Only
Post New Thread
Single Post View       Linear View       Threaded View      f

Report
Bus Route Program Problem Posted by fatti1477 on 5 Mar 2010 at 3:18 AM
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.




 

Recent Jobs

Official Programmer's Heaven Blogs
Web Hosting | Browser and Social Games | Gadgets

Popular resources on Programmersheaven.com
Assembly | Basic | C | C# | C++ | Delphi | Flash | Java | JavaScript | Pascal | Perl | PHP | Python | Ruby | Visual Basic
© Copyright 2011 Programmersheaven.com - All rights reserved.
Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
Operated by CommunityHeaven, a BootstrapLabs company.