Lab 8 – A Simple Transcript Solution



If you complete the lab and submit to handin before Wednesday at midnight, you are not required to attend lab Thursday. If you have not submitted your assignment before Wednesday and you do not attend Thursdays lab, you will receive a 0 on the lab.


In today’s lab, we will implement member functions for a simple transcript class.

Lab Objectives

  • C++ class specification and implementation files

  • Searching an array

Prior to Lab

Make sure you understand how classes are defined in C++ and how three files are involved in using a class: the class specification file, the class implementation file, and the client program file.

The lab code you will be given includes std::replace to substitute one character for another in a string. You do not need to modify the code that uses it; however, if you are interested in how it is called, see this page for details of this function:

Lab Instructions

You will be given five files, SimpleTranscript.h, SimpleTranscript.cpp, test1.cpp, test2.cpp, and test3.cpp. You need to fill in the missing code for four of the public member functions in SimpleTranscript.cpp. The sections that are missing code are marked with the comment


Your Objectives

  • Add a course to a student’s transcript
    • The validity checks for the input parameters are already given in the starter code
    • The forgiven course flag is set to false when you add a course
  • Forgive the grade in an existing course
    • You must search the course names to find a match
    • If there is a match, you should set the forgiven course flag for the course to true and return true
    • If there is no match, return false
  • Print out a formatted transcript according to the example output below
  • Calculate the GPA for a transcript
    • Only unforgiven courses should be used for calculating the GPA
    • If there are no unforgiven courses, return 0

Compile and Execute

Use G++ to compile your code as follows (this shows test1 as the client):

g++ -Wall -g SimpleTranscript.cpp test1.cpp –o test1

Execute the program


Sample Output

Here is the expected output for the test1 client program:

Jane Doe is a new student and should have no courses:

Transcript for Jane Doe

There are no courses

Her GPA should be 0: 0

Let’s add three courses and print her transcript.

Transcript for Jane Doe

CPSC 1010 B

CPSC 1020 A

MATH 1060 D

Her GPA is 2.66667

Let’s forgive her math course and see the change.

Transcript for Jane Doe

CPSC 1010 B

CPSC 1020 A


Her GPA is 3.5

Let’s forgive an incorrect course and see the change.

Your code correctly detected that there was no match!

Let Jane retake the math course.

Transcript for Jane Doe

CPSC 1010 B

CPSC 1020 A


MATH 1060 A

Her GPA is 3.66667

The expected output for the test2 client program is:

A transcript for John Smith has been created and saved.

You will also see a new file in your directory named John_Smith.txt.

The expected output for the test3 client program is:

The transcript for John Smith should be loaded by the constructor.

Transcript for John Smith

CPSC 1010 A

ENGL 1030 B

MATH 1060 B

POSC 1010 C

His GPA is 3

Note that if you run test2 multiple times, it will continue to add redundant courses to John Smith’s file. You should remove the John_Smith.txt prior to each run of test2.

// Sample Header


your name


Lab 8

Lab Section:

Name of TA



  1. Your program should be well documented

  2. Each file should include a header:

  3. Your program should consist of proper and consistent indention

  4. No lines of code should be more than 80 characters

5 – 10 points will be deducted for each of the above formatting infractions.

Submission Instructions

  • Test your program on the School of Computing server prior to submitting.

  • Use the tar utility to tar.gz all source files. Do not tar an entire directory! When I untar your archive, I should see all the files you included, not a top-level directory! Failure to correctly tar may result in up to a 25-point penalty!

EX. tar –czvf yfeaste_lab8.tar.gz SimpleTranscript.cpp