Solved

procedure to find wage

Posted on 2000-03-20
4
278 Views
Last Modified: 2010-04-16
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.
0
Comment
Question by:kazooie21
  • 2
  • 2
4 Comments
 

Author Comment

by:kazooie21
ID: 2638376
Adjusted points from 30 to 40
0
 
LVL 48

Accepted Solution

by:
dbrunton earned 40 total points
ID: 2639037
procedure FINDPAY (name: string; age: integer; years: integer);

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

Try the above procedure.  It's not tested but should work.
0
 

Author Comment

by:kazooie21
ID: 2642437
The procedure worked, but I now need it receive all employees.
0
 
LVL 48

Expert Comment

by:dbrunton
ID: 2643399
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.
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article was initially published on Monitis Blog, you can read it here . When it comes to deciding which approach to website performance monitoring is best for your business, unfortunately, like so many options in life . . . it depends. In t…
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question