# URgent help needed

Develop a pascal programm that input employee ID , name, the health institution, of each employee , their position and their gross salary. Calculate each employee's total deductions and their net salary using the following information:

Deductions or tax are calculated as follows:

PAYE: 15% of salary that is above 30,000, otherwise its 8% for salary below 30,000

NIS: 3% of salary for all employees

NHT: 4% for salary less than 25,000 and 5% for gross greater than or equal to 25,000

Print each emploees ID , Name , Gross Salary , Total Deduction and Net Salary.

Heres what i tried so far but have a syntax error and cant fix:

Program salaries;
Var
gross_sal:array[1..65]of real;
PAYE:real;
NIS:real;
NHT:real;
Total_ded:array[1..65] of real;
Net_sal:array[1..65] of real;
Health_Ins:array[1..65] of string;
position:array[1..65]of string;
name:array[1..65]of string;
ID:array[1..65] of string;
count:integer;
Begin
writeln('A program that accepts employee Health_Ins,position,gross_sal,ID,name.Calculate and output each name,ID, gross_sal,Total_ded and Net_sal');
For count:=1 to 65 do;
Begin
Write ('Enter employee ID');
Write ('Enter employee name');
Write ('Enter the Health_Ins of employee');
Write ('Enter the position of employee');
Write ('Enter the gross_sal of employee');
IF gross_sal[count]>30000 THEN
PAYE:=0.15*gross_sal[count]
ELSE
PAYE:=0.08*gross_sal[count];
NIS:=0.03*gross_sal[count];
IF (gross_sal[count]<25000) THEN
NHT:=0.04*gross_sal[count]
ELSE
NHT:=0.05*gross_sal[count];
Total_ded[count]:=PAYE+NHT+NIS;
Net_sal[count]:=gross_sal[count] - Total_ded[count];
End;
count:=1;
While count<=65 do
Begin
Write ('employee ID is,'ID[count]);
Write ('gross_salary is,'gross_sal[count]);
Write ('Total_ded is,'Total_ded[count]);
Write ('Net_sal is,'Net_sal[count]);
Write ('employee name is,'name[count]);
count:=count+1;
End;
End.

• You are using up all your memory. You are trying to hold all the information for 65 employees in memory at once. Write the program so that you are dealing with data for only one employee at a time.

If you must have all that data in memory at one time then try reducing the size of the strings. A string takes up 256 bytes. An array [1 .. 65] or string takes up 16640 bytes, about a quarter available for Turbo Pascal.

None of these seven variables really needs 256 bytes of memory. If [b]ID[/b] is the social security number then you only need declare it as [b]string[leftbr]9[rightbr][/b]. For [b]name[/b] you can probably get along with [b]string[leftbr]30[rightbr][/b]. Likewise for [b]Health_Ins[/b] and [b]position[/b].

Good luck.

[code]
Var
gross_sal:array[1..65]of real;
PAYE:real;
NIS:real;
NHT:real;
Total_ded:array[1..65] of real;
Net_sal:array[1..65] of real;
Health_Ins:array[1..65] of [red]string[30][/red];
position:array[1..65]of [red]string[30][/red];
name:array[1..65]of [red]string[30][/red];
ID:array[1..65] of [red]string[9][/red];
count:integer;
[/code]
• : You are using up all your memory. You are trying to hold all the
: information for 65 employees in memory at once. Write the program
: so that you are dealing with data for only one employee at a time.
:
: If you must have all that data in memory at one time then try
: reducing the size of the strings. A string takes up 256 bytes. An
: array [1 .. 65] or string takes up 16640 bytes, about a quarter
: available for Turbo Pascal.
:
: None of these seven variables really needs 256 bytes of memory. If
: [b]ID[/b] is the social security number then you only need declare
: it as [b]string[leftbr]9[rightbr][/b]. For [b]name[/b] you can
: probably get along with [b]string[leftbr]30[rightbr][/b]. Likewise
: for [b]Health_Ins[/b] and [b]position[/b].
:
: Good luck.
:
:
: [code]:
: Var
: gross_sal:array[1..65]of real;
: PAYE:real;
: NIS:real;
: NHT:real;
: Total_ded:array[1..65] of real;
: Net_sal:array[1..65] of real;
: Health_Ins:array[1..65] of [red]string[30][/red];
: position:array[1..65]of [red]string[30][/red];
: name:array[1..65]of [red]string[30][/red];
: ID:array[1..65] of [red]string[9][/red];
: count:integer;
: [/code]:
:

Hey thanks for the quick response really appreciate it but could this be the reason for syntax error at line 44? Where the output statements are?

• You need a comma after the single quote, not before it.

I take it you are not getting an error on line 16?