Lab 4 -- 2D Arrays
Objective:
We would like to store student rollbook, with names and their grades in an array. Since there will be several different exams during the semester, we have several grades per student. Thus, we will use a 2D array for the students' grades.
Each row (or column) of the array will contain grades for a different student.
What we will do today:
Store 2D array of student grades. It should accommodate 10 students and grades for 3 tests.
Realize that grades are numeric data, while names are strings. Can we store the student names in the same array?!
Obtain input from the user to populate the array(s).
Write several utility functions to help us work with the grades. Each task should be in a different function. The answer to these questions should be the name of a student, with the corresonding number.
- What is the highest grade that was achieved on the first test? Who achieved it?
-
What is the highest grade that was achieved on test x? Who achieved it? (x is a test number entered by the user. Make sure it is in the valid range!)
-
What is the highest grade anyone achieved on any test? Who achieved it?
-
What is the third student's average grade for all tests?
-
What is the lowest average that any student had for the semester?
Some of these tasks are related. The common functionality can be extracted to a function to allow code reuse and less programming!