Link to home
Start Free TrialLog in
Avatar of kazooie21
kazooie21

asked on

program for a payroll

I need a program that will print the payroll for a company. It's for an assignment. It should read the employee's name, hours worked, base rate of pay, and age.  Their gross wage is computer at regular rate for the first 40 hours and 1.5 times rate for hours over 40. Tax is witheld: 10% on first $200 and 20% on anything over that. The first part of the printout should print this info. The second part should state the average gross pay for employees at least 55 yrs old, gross pay for employees over 55, name and gross pay for employee with largest gross(assume there's not a tie). I don't know how to do the second part, but I think I got a start on the first part: as follows.

program payroll
uses printer;
  var name: string;
      hours, age: integer
      tax, rate, gross pay, net pay: real

begin
 write('Enter number of employees ');
  readln(10);
  sum:= 0;
    for employee:= 1 to 10 do
  begin
    write('Enter name of employee ');
    readln(name);
    write('Enter hours worked and rate ');
   if hours > 40 then
      gross pay:= (hours - 40) * (rate * 1.5)
     end
else gross pay:= hours * rate
   write('Enter age of employee ');
     readln(age);
   write('Enter tax ');
    if gross pay > 200 then
       tax:= (gross pay - 200) * 0.20 + 0.10 + gross pay
     end
     else tax:= gross pay * 0.10
     write('Enter net pay ');
       net:= gross pay - tax
end.
Avatar of kazooie21
kazooie21

ASKER

I need an answer ASAP! It's EXTREMELY urgent!!
since the values don't seem to be stored into an array, you are going to have to use accumulators

accumulators are just regular variables, but with a special purpose: they are added to, or keep a cumulative total

after each employee is input, add the value that was input to a running total, depending on what category they are in (test with the if statement)

when all of the employees are entered, just use the accumulators in any math operations you need to do (such as an average)
ASKER CERTIFIED SOLUTION
Avatar of Batalf
Batalf
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial