This code has a lot of problems. Not just syntax but also logic issues.
- [LOGIC] First of all, you have arrays, but you treat them as scalars (simple variables, not arrays). I don't see why you'd need arrays for this problem
- [SYNTAX] Your if-else has wrong syntax (; mustn't be added before else and there's no such thing as ENDIF if Pascal)
- [LOGIC] After you calculate the gross_pay, you read it from the user, instead of printing it to the user.
- [SYNTAX] you can assign values to variables like this: gross_pay := _____; (and not ____ := gross_pay)
I'll assume you'll need the arrays later and your code is just not finished yet. So I'll publish my fix using the arrays:
PROGRAM Payment;
uses crt;
var
first_name,last_name:Array[1..5] of CHAR;
employee_level:Array [1..5] of INTEGER;
hours_worked:Array [1..5] of REAL;
overtime_pay:Array [1..5] of REAL;
hourly_rate:Array [1..5] of REAL;
gross_pay:Array [1..5] of REAL;
Const
LEVEL1=525;
LEVEL2=1800;
LEVEL3=2000;
RATE=1.5;
BEGIN
writeln('Please enter first name,last name.');
readln(first_name, last_name);
writeln('Please enter employee level.');
readln(employee_level[1]);
writeln('Please enter employee hours worked.');
readln(hours_worked[1]);
writeln('Please enter employee overtime pay.');
readln(overtime_pay[1]);
writeln('Please enter employee hourly rate.');
readln(hourly_rate[1]);
IF hours_worked[1] > 40 THEN
begin
gross_pay[1] := (hours_worked[1] * hourly_rate[1]) + (overtime_pay[1] * 1.5);
end
ELSE
begin
gross_pay[1] := hours_worked[1] * hourly_rate[1];
end;
writeln('gross_pay');
writeln(gross_pay[1]);
END.