Free Essay

Cis247A Week2 Ilab

In: Computers and Technology

Submitted By stormin46
Words 733
Pages 3
In this lab you will be developing 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 = new string[100]; // one-dimensional array to store course numbers string[] courseAr = new string[100]; // two-dimensional array to store grades int[,] gradesAr = new int[100, 4]; private int 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

For 30 points extra credit instead of studentCount, studentNamesAr, courseAr, and gradesAr, create a Student class with the following attribute variables: mStudentName, mCourseNumber, and a 4 element mGradeAr. In the form class create an ArrayList. When you add a new student, create a Student object and add the address to the array list. When you edit a Student object, use the properties in the Student class to allow you to modify the data. When you delete a student, remove that entry from the ArrayList and delete that student from the list box.

As soon as you get your program to work correctly, zip your project together and post that to the Week 2 iLab DropBox basket. Ensure your name, course number and section, and lab number are in comments at the beginning of the program.

Similar Documents