Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

all employees

Posted on 2000-03-21
5
Medium Priority
?
250 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
5 Comments
 

Author Comment

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

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: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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

Simulator games are perfect for generating sample realistic data streams, especially for learning data analysis. It is even useful for demoing offerings such as Azure stream analytics, PowerBI etc.
If you have come across a situation where you need to find some EDB mailbox recovery techniques, then here you will find the same. In this article, we will take you through three techniques using which you will be able to perform EDB recovery. You …
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

886 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