Create a Grade Reporting system for DeVry University. Grades are entered for different students.
The grades should be stored in a two-dimensional (doubly subscripted) array of double numbers. The student's name should be stored in a single-dimensional string array. The student's course should be stored in a single-dimensional string array. Allow the program to store up to 100 students' grades. Once the student's grades have been added, display the student's name, course and average grade in the list box. The list box sorted property should be set to true.
To edit a student's grades, select an entry from the list box. You will need to search through the students name array to find a match. Pull the information from the arrays and put them in the controls in the submit area. Disable the student's name and course text boxes, list box, and Edit and Delete buttons. The user may only modify the grades. These will be updated in the grades array and the average redisplayed in the list box.
When a student's grades are deleted, physically move the data up in the arrays.
See the Sample Output below for further instructions.
Pseudocode:
Declare this at the top of the form class
// initialize number of students to zero
int studentCount = 0;
// one-dimensional array to store student names
string[] studentNamesAr = newstring[100];
// one-dimensional array to store course numbers
string[] courseAr = newstring[100];
// two-dimensional array to store grades
int[,] gradesAr = newint[100, 4];
privateint mEditedIdx = -1;
Submit button event handler
Ensure that the students's name is not blank.
Ensure that the course number is not blank.
If mEditedIdx >= 0
idx = mEditedIdx
Else
idx = studentCount
End-If
Put the student's name and course number in the arrays.
Using try/catch exception handling convert each grade to a int and add to the array.
If the data is invalid, display an error message and return the user to the form.
If mEditedIdx >= 0
Set mEditedIdx to -1
Enable the student name and course number text boxs, the Edit and Delete buttons,
and the listbox.
Change the title in the group box to "Input Student's Grades"
Else
Add 1 to student count
End-If
Execute the DisplayStudents method
Clear the text boxes
If student count = 100
Disable the Submit button
End-If
Display Students Method
Clear the list box
Write the heading line
For each student write the student's name, course number and average grade to the list box
Edit Button Click Event Handler
Ensure the user has selected a student in the list box
Pull the student's name and course number from the line in the list box
Search through the array till you find a match on student name and course number
Set mEditedIdx to the index in the array where the match was found
Copy the data from the arrays into the text boxes
Disable the Edit and Delete buttons, the student name text box, course number text box and the list box
Change the group box heading to "Edit Student's Grades"
Delete Button Click Event Handler
Ensure the user has selected a student in the list box
Pull the student's name and course number from the line in the list box
Search through the array till you find a match on student name and course number
Ask the user if he really wants to delete this student's information.
Delete that student's information out of the arrays by copying the data up one cell
Subtract 1 from student count
Execute the Display Students method
Sample Output from Lab 2:
I pressed the Submit Button without entering any data. Got this message box telling me the student's name must be entered.
Pressed the Submit Button without entering the course. Got this message box telling me the course must be entered.
Pressed the Submit Button without entering any grades. Got this message box telling me Grade 1 is Invalid.
Also ensure the grade is not negative.
Pressed Submit Grades with the following data.
Once Submit Sales was pressed, the information was added to the internal arrays and the student's name, course and average were displayed in the list box.
I added grades for another student.
The list box displays the sales in order by student name.
I selected a student to edit.
Then pressed Edit. The student name and course text boxes, the list box, and the edit and delete buttons were disabled. The user may only change the grades. I changed grade 3.
When I clicked Submit Grades, this was displayed:
I selected a student to delete and pressed delete.
The program displays a verification message box.
I selected Yes and the student's data was deleted from the arrays and the list box regenerated.