ERROR ILLEGAL EXPRESSION - Programmers Heaven

Howdy, Stranger!

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

Categories

ERROR ILLEGAL EXPRESSION

nattylinuxnattylinux Posts: 4Member
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.

Comments

  • _Atex__Atex_ Posts: 163Member
    : 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;
    : [red][b]NetPay:=(GrossPay+Bonus)-Tax;[/b][/red]
    : Writeln(Firstname[X],Surname[X]);
    : Writeln('HAVE A NICE DAY!');
    : end;
    : Readln;
    : END.

Sign In or Register to comment.