kazooie21
asked on
all employees
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.
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.
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.
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.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
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.
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.
¿Did I post that as an answer?
I'd swore I'd posted it as a comment...
Anyway, thanx for the bucks !!!
I'd swore I'd posted it as a comment...
Anyway, thanx for the bucks !!!
ASKER