CSCE 2004 - Homework 2
Due Date - 09/27/2013 at 11:59 PM

1. Problem Statement:

The primary goal of this programming assignment is to give students experience with if statements and while loops. A secondary goal is to give students a chance to modify and extend an existing program. To meet these goals, students will be required to improve their previous GPA program to make the program more flexible and more robust.

Improve flexibility: Your previous program had a hard coded limit of 5 classes that would be used to calculate the GPA. This is very limiting because not all students take 5 classes in a semester, and there is no way to calculate the GPA for a full year, or for the whole degree. To make your program more flexible, you should ask the user to enter the number of classes they would like to process, and then loop in the program to read and process the class grades and credit hours to calculate the GPA.

Improve robustness: Your previous program you had the option to read grades as A,B,C,D,F characters or as numbers between 0 and 4. At that time, you were not required to any error checking to make sure the user actually followed directions. In this assignment, you should assume that grades will be entered using only A,B,C,D,F characters. To make your program more robust, you need to add code to check the user's input to see if it is valid, and loop until the grade information is input correctly. A similar check should be added to the number of credit hours to make sure these values are sensible.

Students are allowed to use any combination of if statements, switch statements, and while loops they need to complete this assignment. You are not required or allowed to look ahead to more advanced C++ features like arrays or user defined functions to perform this task.

2. Design:

For this assignment, you have three big design decisions. First, you must decide what order you want the user to enter input data. Second, you must figure out if the user actually followed directions, and what to do to force the user to enter valid data. Finally, you must implement the GPA calculation with a variable number of class grades. Make sure you write comments in your code to explain your design decisions.

3. Implementation:

Since you are starting with your previous program, you already have something that compiles and runs. Since you must add several features to this program, it is important to make these changes incrementally one feature at a time, writing comments, adding code, compiling, and debugging. This way, you always have a program that "does something" even if it is not complete.

4. Testing:

Test your program to check that it operates correctly for all of the requirements listed above. Also check for the error handling capabilities of the code. Try your program with several input values, and save your testing output in text files for inclusion in your project report.

5. Documentation:

When you have completed your C++ program, write a short report (less than one page long) describing what the objectives were, what you did, and the status of the program. Does it work properly for all test cases? Are there any known problems? Save this report in a separate text file to be submitted electronically.

6. Project Submission:

In this class, we will be using electronic project submission to make sure that all students hand their programming projects and labs on time, and to perform automatic analysis of all programs that are submitted. When you have completed the tasks above go to the class web site to "upload" your documentation (a single pdf or txt file), and your C++ program (a single cpp or txt file). Do NOT upload an executable version of your program.

The dates on your electronic submission will be used to verify that you met the due date above. All late projects will receive reduced credit:

You will receive partial credit for all programs that compile even if they do not meet all program requirements, so handing projects in on time is highly recommended.