CS 1401 Assignment #11

Date Assigned: Monday, April 17, 2006 or Tuesday, April 18, 2006.

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 A
To 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: Overall, the student earned 12 + 4 = 16 points, and he took 4 + 1 = 5 credit hours -- so his GPA is 16 / 5 = 3.2.

Write an application that:

Use a for-loop to compute the overall number of CS credit hours and the overall number of CS points.

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.