Solved

all employees

Posted on 2000-03-21
5
239 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
Comment Utility
Adjusted points from 0 to 5
0
 
LVL 47

Expert Comment

by:dbrunton
Comment Utility
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 5 total points
Comment Utility
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
Comment Utility
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
Comment Utility
¿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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Find out what Office 365 Transport Rules are, how they work and their limitations managing Office 365 signatures.
A procedure for exporting installed hotfix details of remote computers using powershell
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

763 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

Need Help in Real-Time?

Connect with top rated Experts

6 Experts available now in Live!

Get 1:1 Help Now