We help IT Professionals succeed at work.
Get Started

Pascal Helo

seraph_matrix_631
on
1,285 Views
Last Modified: 2008-03-10
I am new to pascal and i have been asked to make a program that willa llow the user to type the amount of miles they have driven.
then to take this number and multiply it by 0.20  (they get 20p per mile driven) then output the information to the user as:


you have driven  xxx miles
your travelling allowance is £xx.xx

press any key to continue...



this is what i ahve done so far. please bear in mind i am a total beginner so comments in the code would be excellent so i understand it and so i can apply the knowledge to other programs.




program TASK1(INPUT,OUTPUT);
USES CRT;

var      miles              :integer;
         pay            :integer;
         allowance            :INTEGER;

begin

pay:=0.20;

     WRITELN ('ENTER NUMBER OF MILES DRIVEN:  ');
     READ(miles); {take input from user}
     WRITELN(' ');


     WRITELN(miles , '*', pay , '= ', allowance );
     WRITE('PRESS ANY KEY TO CONTINUE');

     READKEY;  {THIS WAITS FOR YOU TO PRESS A KEY}

end.



thank you in advance.
the compiler says there are 3 errors:

1. 17 / 50 assignment1.pas
 Warning: Variable ALLOWANCE does not seem to be initialized

2. 10 / 6 assignment1.pas
 Error: Incompatible types: got "S80REAL" expected "LONGINT"

3. 23 assignment1.pas
 Fatal: There were 1 errors compiling module, stopping



from mr skulls
Comment
Watch Question
This problem has been solved!
Unlock 2 Answers and 9 Comments.
See Answers
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE