**Due Date:** correspondingly, Monday, April 24, 2006, or
Tuesday, April 25, 2006, before the beginning of your lab
section.

**Goals:** to learn how to use for-loops and arrays.

**Points:** This assignment is worth a total of 20 points. No
late assignments will be accepted, but credit will be given for
partially completed assignments turned in on time.

**Assignment:** A graduation form for Computer Science students
includes an overall GPA and a GPA in major. Overall GPA is
automatically computed by Goldmine; however, computing
a CS GPA is a difficult task
in which Goldmine does not help. Let us help the graduating students
in computing their CS GPA.

For each student, all the classes that this student took and the corresponding grades are stored in a file. The first line of this file contains the student's name; every other line contains the catalog number of the class and the grade that the student received in this class. For example, for John Johnson, this file may take the following form:

John Johnson MATH 3111 A CS 1401 B CS 3195 ATo compute the GPA, we must take all the grades in CS classes, multiply each grade by the number of hours in the corresponding class (the number of hours is the second digit of the class number), add the overall number of points, and divide this number by the total number of hours in CS classes. For example, for John Johnson, we have:

- The first class is Math class, not a CS class, so it produces no CS points.
- The second class is a CS class. The second digit in its number (1401) is 4, so this is a 4-credit class. John Johnson earned 3 points (corresponding to B) for this 4-credit class, so the total number of points for this class is 3 x 4 = 12 points.
- The third class is also a CS class. The second digit in its number (3195) is 1, so this is a 1-credit class. John Johnson earned 4 points (corresponding to A) for this 1-credit class, so the total number of points for this class is 4 x 1 = 4 points.

Write an application that:

- asks the user for a name of the file where the grades are stored;
- reads the data, from the file, into the variable
*studentName*and into the following two arrays:- array
*creditHours*that contains the number of credit hours for all the CS classes that a student took; - array
*grades*that contains the numerical grades for the corresponding CS classes;

- array
- computes and displays (after displaying the student's name):
- the overall number of CS credit hours;
- the overall number of CS points;
- the student's GPA in major.

**Deliverables:** as announced in the labs.

**Homework part.** On a separate sheet of paper, please do
Exercise 3, 7, 8, and 9 (pp. 514-516).
Explain your answers. Return the sheet with your answers to your TA by,
correspondingly, Wednesday April 19 or Thursday April 20
before the beginning of your lab session.