I am writing a program for a college assignment to compute grades of students. the code compiles ok, but i keep getting a runtime error 2. can anyone help?
{Author: George Brandon Miller}
{Program: Grade Report - Compute the grade point average for students}
Program Grades;
var
{ misc. program variables }
more_records:boolean; {end of file flag }
line_count:integer; {lines written count}
page_no:integer; {page count}
{Student Variables}
FileIn:typedfile; {Input File Handle}
FileOut:text; {Output File Handle}
SECTION_NUMBER:string[5]; {Section number of the class}
STUDENT_ID:string[9]; {Student identification number}
LAST_NAME:string[20]; {Students last name}
FIRST_NAME:string[10]; {Students first name}
RAW_SCORE:real; {Points totaled by the student}
STUDENT_COUNT:integer; {total number of students}
AVERAGE_SCORE:integer; {Average score for all the students}
AVERAGE_GRADE:integer; {Grade for the student}
PERCENT:real;
procedure read_record;
begin
if not Eof(fileIn) then
readln(SECTION_NUMBER,STUDENT_ID,LAST_NAME,FIRST_NAME,RAW_SCORE)
else
more_records := False
end; {read record}
procedure print_header; {print header at top of page}
begin
writeln(FileOut,space(14),'CIS150 GRADE REPORT',space(8),page_no);
writeln(FileOut,space(17),'SECTION','SECTION_NUMBER');
Writeln(FileOut);
writeln(FileOut,space(9),'LAST',space(11),'FIRST',' RAW',' COMPUTED');
writeln(FileOut,space(9),'NAME',space(11),'NAME',' SCORE',' GRADE');
Writeln(FileOut);
Writeln(FileOut);
Writeln(FileOut);
Writeln(FileOut);
Writeln(FileOut,'STUDENT COUNT',STUDENT_COUNT);
Writeln(FileOut,'AVERAGE SCORE',AVERAGE_SCORE);
Writeln(FileOut,'AVERAGE GRADE',AVERAGE_GRADE);
end;
{INITIALIZE - open files and print header}
procedure initialize;
begin
assign(fileIn,'C:\Users\Owner\Classes\CIS 150\Data\PRG3-150.DAT');
reset(fileIn);
assign(Fileout,'C:\Users\Owner\Classes\CIS 150\Data\grades.rpt');
rewrite(fileout);
read_record;
print_header
end;
procedure process;
begin
{skip to new page if needed}
Inc(line_count);
if line_count > 50 then
Print_header;
percent := (Raw_Score / 850.0) * 100.0;
writeln(FileOut,Last_Name,Space(2),First_Name,Space(3),percent);
read_record;
end;
procedure wrapup;
begin
writeln(FileOut);
writeln(FileOut,'Student_Count');
Close(FileIn);
Close(FileOut);
end;
begin
initialize;
while more_records do
process;
wrapup
end.