# Pascal Help needed!!!

A high school class consists of 30 students, each pursuing the courses English, Mathematics, Accounts, Economics, Geography and Principles of Business. The form teacher desires to conduct a critical evaluation of the performance of students in the courses pursued. She desires to know the following:
 Average percentage score for each student
 Each student’s highest score
 Each student’s lowest score
 Average score for each course
 Highest score for each course
 Lowest score for each course

1. Design a program plan and pseudo code that will facilitate this analysis. [20]
2. Develop the Pascal program. [15]

The program must:
a. Allow input of data (row-wise or column-wise);
b. Output the entire matrix;
c. Output analysis of the matrix.

I have no idea, any help would be greatly appreciated. Thanks.

• This entire text assumes you know how to calculate an average of an array of numbers, and also how to find the lowest and highest number in an array. It also uses records. At the end is the data-matrix without records.

The best way to do this is start with the data-matrix. You have an array of students, which each consist of a name and an array of scores. Basically this data can be coded as follows:
[code]
type
TStudent = record
Name:string;
Scores:array[1..6] of integer;{or double}
end;
TStudents = array[1..30] of TStudent;
[/code]
Next the input is considered. It should consist of two procedures, on for row-wise entry and one for column-wise. The difference of these two is only which array you iterate through. Either the TStudents array, or the Scores array.
The output of the matrix is also quite simple. This is nothing more than a number of writes and writelns inside a nested for-do loop. Here is part of such code:
[code]
procedure ShowData;
var
Student,Score:integer;
begin
for student:=1 to 30 do begin
write(Students[student].name,' '); { first column: student name }
for score:=1 to 6 do begin
write(Students[student].Scores[score],' ');
{ 6 columns listing each grade }
end;
writeln; { Next row }
end;
end;
[/code]
The lowest, average, and highest scores for each student can then be evaluated and possibly added to the TStudent record:
[code]
TStudent = record
Name:string;
Scores:array[1..6] of integer;{or double}
Lowest:integer;{or double}
Highest:integer;{or double}
Average:integer;{or double}
end;
[/code]
The lowest, average, and highest score for each course can be evaluated and recorded separately in two additional arrays.

Non-record Codes:
[code]
var
StudentNames:array[1..30] of string;
StudentScores:array[1..30,1..9] of integer;
{ Places [*,1] to [*,6] hold the scores for each cource
Place [*,7] is the lowest score
Place [*,8] is the average score
Place [*,9] is the Highest score
* is any number from 1 to 30 }

procedure ShowData;
var
Student,Score:integer;
begin
for student:=1 to 30 do begin
write(StudentNames[student],' '); { first column: student name }
for score:=1 to 6 do begin
write(StudentScores[student,score],' ');
{ 6 columns listing each grade }
end;
writeln; { Next row }
end;
end;
[/code]

Good Luck with the development of your program.