Solved

all employees

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

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: 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

Suggested Solutions

Title # Comments Views Activity
How to send email in delphi with image 4 595
How do you get the IP address of a network? 12 289
Secure Boot on W8 & 8.1 8 47
Pass a string reference from one unit to another 8 125
Did you know that more than 4 billion data records have been recorded as lost or stolen since 2013? It was a staggering number brought to our attention during last week’s ManageEngine webinar, where attendees received a comprehensive look at the ma…
Active Directory security has been a hot topic of late, and for good reason. With 90% of the world’s organization using this system to manage access to all parts of their IT infrastructure, knowing how to protect against threats and keep vulnerabil…
Although Jacob Bernoulli (1654-1705) has been credited as the creator of "Binomial Distribution Table", Gottfried Leibniz (1646-1716) did his dissertation on the subject in 1666; Leibniz you may recall is the co-inventor of "Calculus" and beat Isaac…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

679 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