Programming
Assignment 13
In this assignment
you are to write a program which will read a student's name and letter grade in
several courses. These will be echoed
to the output file and the gpa will be calculated and printed.
The input looks
like the following:
Joe
College
C+ English Composition
A Introduction to Programming
B- First Year Seminar
B+ Introduction to Anthropology
The output should
look exactly like the following (with the blank lines)
Joe
College
English
Composition C+
Introduction
to Programming A
First
Year Seminar B-
Introduction
to Anthropology B+
GPA =
3.08
Your program should
do the following things:
1. Open the
input and output files.
2. Read and
print the student's name (use a function).
3. Loop
through the student's courses until the end of the file is encountered.
a. Read an entire line (use the getline function).
b. Get the letter, modifier and course
from the string line.
c. Write the course, letter and modifier.
d. Compute the number of points by using 2
functions which convert the letter and the modifier to the appropriate
values. (Use the switch statement in both functions.)
Letters: A = 4.0, B = 3.0, C = 2.0, D = 1.0, F = 0.0
Modifiers: + (add
0.3), - (add -0.3)
e. Sum the points and count the number of
courses.
4. Calculate
and print the gpa.