Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

all employees

Posted on 2000-03-21
5
Medium Priority
?
248 Views
Last Modified: 2010-04-16
How can I rewrite this program so it will receive all employees as input?

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


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);
  end; {FINDPAY}

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

0
Comment
Question by:kazooie21
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 

Author Comment

by:kazooie21
ID: 2642766
Adjusted points from 0 to 5
0
 
LVL 49

Expert Comment

by:dbrunton
ID: 2643430
You did post.  Try the following code and see if it works and see if you can work out what to do next.

type
  datatype = record
    name : string;
    age : integer;
    years : integer
  end;
  data_array = array[1..5] of datatype;

var
  thedata : data_array;
  i : integer;

begin
  for i := 1 to 5 do
    begin
      readln(thedata[i].name);
      readln(thedata[i].age);
      readln(thedata[i].years);
     end;
end.  
0
 
LVL 3

Accepted Solution

by:
vikiing earned 20 total points
ID: 2644684
begin {main}
    Repeat
       Write('Name ? '); Readln(name);
       If name>'' then begin
         Write('Age  ? '); Readln(age);
         Write('Years? '); Readln(years);
         FINDPAY (name, age, years)
       end;
    until name='';
end.
0
 
LVL 1

Expert Comment

by:nrico
ID: 2644804
The answer depends on what you want to do with the information. If you just want to display the wages, use a non-commited way like vikiing proposed.
If you want to save it to disk or manipulate it in some other way, store it in an array (or a linked list -- pretty difficult) as dbrunton suggested.
0
 
LVL 3

Expert Comment

by:vikiing
ID: 2648913
¿Did I post that as an answer?

I'd swore I'd posted it as a comment...

Anyway, thanx for the bucks !!!
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering 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

Read on to get a few ideas on how to promote your next corporate event.
In this article, I’ll show how research, determination, and use of modern technology helped me solve a DNA mystery.
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …

721 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