kazooie21
asked on
can't find file?
Ok, here's the deal. This program should process a list of applicants: name number of cigarettes smoked each day, and weight. If they meet the criteria (numb > 10) and (wt > 180) then a message should be printed 'Accepted". If not, then a message should be printed 'Rejected' and also printed will be the reason why they're rejected. It should also print each applicant's name, number of cigarettes, and weight. (The 'Rejected'(+ reasons) or 'Accepted' should come after the name, cigarette# , and weight) For all 'Accepted' applicants, it should print the average number of cigarettes smoked daily and the average weight. Here's what I got sofar, but when I try to compile it, it gives me 'Cannot find file' on the reset(AppFile) line. I've created that file!
var name: string;
numb: integer;
wt: integer;
AppFile: text;
procedure GETDATA (var AppFile: text;
var name: string;
var numb: integer;
var wt: integer);
begin
readln (AppFile, name);
readln (AppFile, numb);
readln (AppFile, wt);
end; {GETDATA}
procedure POSITION (name: string;
numb: integer;
wt: integer);
begin
if (numb < 10) and (wt < 180) then
writeln ('Accepted ');
if not (numb < 10) and (wt < 180) then
writeln ('Rejected ');
writeln ('Your weight is more than the given weight ');
writeln ('The number of cigarettes you smoke is over the limit ');
end; {POSITION}
begin {main}
assign (AppFile, 'AppFile2.dat');
reset (AppFile);
while not seekeof (AppFile) do
begin
GETDATA (AppFile, name, numb, wt);
POSITION (name, numb, wt);
end;
close (Appfile)
end.
var name: string;
numb: integer;
wt: integer;
AppFile: text;
procedure GETDATA (var AppFile: text;
var name: string;
var numb: integer;
var wt: integer);
begin
readln (AppFile, name);
readln (AppFile, numb);
readln (AppFile, wt);
end; {GETDATA}
procedure POSITION (name: string;
numb: integer;
wt: integer);
begin
if (numb < 10) and (wt < 180) then
writeln ('Accepted ');
if not (numb < 10) and (wt < 180) then
writeln ('Rejected ');
writeln ('Your weight is more than the given weight ');
writeln ('The number of cigarettes you smoke is over the limit ');
end; {POSITION}
begin {main}
assign (AppFile, 'AppFile2.dat');
reset (AppFile);
while not seekeof (AppFile) do
begin
GETDATA (AppFile, name, numb, wt);
POSITION (name, numb, wt);
end;
close (Appfile)
end.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Waitasec, you're ACCEPTING people on the basis of smoking regularly and being fat!!??