Pascal

Moderators: None (Apply to moderate this forum)
Number of threads: 4106
Number of posts: 14016

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

Report
ERROR ILLEGAL EXPRESSION Posted by nattylinux on 25 Feb 2013 at 9:06 AM
This pascal program should calculate net pay etc. Got it down to one error that says;
Payroll2.pas(40,33) Error: Illegal expression
Payroll2.pas(45,4) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /usr/bin/ppc386 returned an error exitcode (normal if you did not specify a source file to be compiled)

Any help would be appreciated.



Program Payroll2(input,output);
uses crt;
CONST
BasicRate=2350;
TaxRate=0.165;
VAR
Firstname:Array[1..6]of String;
Surname:Array[1..6]of String;
Overtime_Pay,GrossPay,Tax,Bonus,NetPay:Real;
Hoursworked,X:Integer;
Overtime_Rate:Real;
Begin
clrscr;
X:=0;
GrossPay:=0;
Tax:=0;
Overtime_Pay:=0;
NetPay:=0;
Bonus:=0;
FOR X:=1 TO 6 DO
begin
Writeln('Please enter your firstname,surname and hours worked');
Readln(Firstname[X],Surname[X],Hoursworked);
IF Hoursworked <= 40 THEN
Begin
Writeln('hours are 40 or less');
Writeln('test line #2');
//Overtime_Pay:=(Hoursworked-40)*(BasicRate*1.5);
//GrossPay:=(BasicRate*40)+Overtime_Pay;
//Tax:=GrossPay*TaxRate;
end;

IF Hoursworked <= 40 THEN
begin
Writeln('hours more than 40');
Bonus:=BasicRate*0.5;
end;
if Hoursworked > 40 THEN
Bonus:=BasicRate*0.2;
NetPay =(GrossPay+Bonus)-Tax;
Writeln(Firstname[X],Surname[X]);
Writeln('HAVE A NICE DAY!');
end;
Readln;
END.
Report
Re: ERROR ILLEGAL EXPRESSION Posted by _Atex_ on 25 Feb 2013 at 8:41 PM
: This pascal program should calculate net pay etc. Got it down to one
: error that says;
: Payroll2.pas(40,33) Error: Illegal expression
: Payroll2.pas(45,4) Fatal: There were 1 errors compiling module,
: stopping
: Fatal: Compilation aborted
: Error: /usr/bin/ppc386 returned an error exitcode (normal if you did
: not specify a source file to be compiled)
:
: Any help would be appreciated.
:
:
:
: Program Payroll2(input,output);
: uses crt;
: CONST
: BasicRate=2350;
: TaxRate=0.165;
: VAR
: Firstname:Array[1..6]of String;
: Surname:Array[1..6]of String;
: Overtime_Pay,GrossPay,Tax,Bonus,NetPay:Real;
: Hoursworked,X:Integer;
: Overtime_Rate:Real;
: Begin
: clrscr;
: X:=0;
: GrossPay:=0;
: Tax:=0;
: Overtime_Pay:=0;
: NetPay:=0;
: Bonus:=0;
: FOR X:=1 TO 6 DO
: begin
: Writeln('Please enter your firstname,surname and hours worked');
: Readln(Firstname[X],Surname[X],Hoursworked);
: IF Hoursworked <= 40 THEN
: Begin
: Writeln('hours are 40 or less');
: Writeln('test line #2');
: //Overtime_Pay:=(Hoursworked-40)*(BasicRate*1.5);
: //GrossPay:=(BasicRate*40)+Overtime_Pay;
: //Tax:=GrossPay*TaxRate;
: end;
:
: IF Hoursworked <= 40 THEN
: begin
: Writeln('hours more than 40');
: Bonus:=BasicRate*0.5;
: end;
: if Hoursworked > 40 THEN
: Bonus:=BasicRate*0.2;
: NetPay:=(GrossPay+Bonus)-Tax;
: Writeln(Firstname[X],Surname[X]);
: Writeln('HAVE A NICE DAY!');
: end;
: Readln;
: 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.