Link to home
Start Free TrialLog in
Avatar of kazooie21
kazooie21

asked on

procedure to find wage

company wage formula: $100 +$(employee's age) +$(1 + 2 + 3....+years)

A 37 year old employee with six years would earn $158 (that is, 100 + 37 + 21).  (the value 21 comes from 1 + 2 + 3 + 4 + 5 + 6)

I need a program that will receive as input one employee's name, age, and years and print the wage information. I've used the FINDPAY procedure. this procedure will need to calculate and print employee's name and wage information.

Here's what I got:

var name: string;
      age: integer;
      years: integer;
      i: integer;

procedure FINDPAY (name: string;
                                 age: integer;
                                 years: integer;
                                  i: integer);

var wage: integer;
begin
    for i:= 1 to years
          do
              wage := $100 + age + i;
               writeln (name, ' $', wage:5:1);
end; {FINDPAY}

begin {main}
    name := 'Jack' ;
     age := 54;
    years := 32;
    FINDPAY (name, age, years)
end.
Avatar of kazooie21
kazooie21

ASKER

Adjusted points from 30 to 40
ASKER CERTIFIED SOLUTION
Avatar of dbrunton
dbrunton
Flag of New Zealand 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
The procedure worked, but I now need it receive all employees.
Post another question explaining what you want.  It's not quite clear enough.  Are you getting info from keyboard or file.  Whatever you will probably need to use records and an array of records to hold what you want.