{
Assignment 2, Program 2
name: "pay calculator"
By: Ben Weir, CIS 31
Last Modified: Sept. 11, 1996
this program gets information about an employee
and calculates his/her weekly pay
}
program ComputePay;
var
id_num, {employee's ID number}
dependents, {number of dependents he/she has}
hours, {hours worked in one week}
overtime {hours overtime worked}
:integer;
gross_pay, {pay before deductions}
net_pay {pay after deductions}
:real;
const
rate = 9.73; {pay rate of employee}
sstax = 0.06; {Social security tax}
fitax = 0.14; {federal income tax}
sitax = 0.05; {state income tax}
union_dues = 6; {weekly union dues}
health_cost = 10; {health care cost if 3 or more dependents}
quit_id = 999; {terminate the program if this is the ID}
begin
repeat {get a valid employee}
write('What is your ID number (999 to quit)? '); {number (0 to 999) }
readln(id_num);
until (id_num > 0) and (id_num < 1000);
while id_num <> 999 do
begin
write('How many hours did you work? '); {get hours worked}
readln(hours); {and number of }
write('How many dependents do you have? '); {dependents }
readln(dependents);
if hours > 40 then {see if there's any}
overtime := hours - 40 {overtime worked}
else
overtime := 0;
{calculate net pay and gross pay}
net_pay := (hours * rate) + (overtime * rate * 0.5);
gross_pay := net_pay - (net_pay * sstax) - (net_pay * fitax) - (net_pay * sitax) - 6;
if dependents >= 3 then gross_pay := gross_pay - 10;
writeln;
writeln('---------------------');
writeln('Employee ',id_num,':'); {display the results}
writeln(' Net Pay: $', net_pay: 1: 2);
writeln('Gross Pay: $', gross_pay: 1: 2);
writeln('---------------------');
writeln;
repeat {get a valid}
write('What is your ID number (999 to quit)? '); {employee # }
readln(id_num);
until (id_num > 0) and (id_num < 1000);
end; {main program}
end.
               (
geocities.com/siliconvalley/park)                   (
geocities.com/siliconvalley)