Solved

all employees

Posted on 2000-03-21
5
247 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 5 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

Getting to know the threat landscape in which DDoS has evolved, and making the right choice to get ourselves geared up to defend against  DDoS attacks effectively. Get the necessary preparation works done and focus on Doing the First Things Right.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

635 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