Assignment #4 – The Obsessive Student’s Calculator

Due Mon. Feb. 19 at 3:30 PM

This program’s purpose is to take the hard work out of obsessing over your grades. It will calculate your GPA for the semester, calculate what grade you need on an exam to get a certain average, and calculate what GPA you need this semester to keep your scholarship. This way, you’ll know where you stand and have that much brainpower left to study.

Your program should display a menu with the available options (listed above, plus “Quit”). It should accept and error-check a choice from the user, then perform the desired calculation.

Sample Output

Welcome to the Obsessive Student’s Calculator.
What do you need to know?
1. What’s my GPA?
2. How well do I have to do on the final to get my grade?
3. How well do I have to do this semester to keep my scholarship?
4. I already know too much. Let me out of here.
Enter your choice: 1

Enter the credit hours of the class and your letter grade at the prompt. Press ‘Q’ to quit entering.
Credit hours: 4
Letter grade: A
Credit hours: 3
Letter grade: B
Credit hours: 4
Letter grade: A
Credit hours: 3
Letter grade: A
Credit hours: 3
Letter grade: C
Credit hours: Q

Your GPA is 3.471

What do you need to know?
1. What’s my GPA?
2. How well do I have to do on the final to get my grade?
3. How well do I have to do this semester to keep my scholarship?
4. I already know too much. Let me out of here.
Enter your choice: 2

Is your class’s grading based on the point system (1) or percentage system (2)?: 1

How many points do you have now?: 878
How many points are possible in the course?: 1000
What percentage grade do you want to end up with?: 90

You need 22 points on the final.

What do you need to know?
1. What’s my GPA?
2. How well do I have to do on the final to get my grade?
3. How well do I have to do this semester to keep my scholarship?
4. I already know too much. Let me out of here.
Enter your choice: 3

What is your current GPA (not including this semester)?: 3.12
How many credit hours have you completed (before this semester)?: 32
How many credit hours are you attempting this semester?: 17

You need a GPA of 2.774 this semester to keep your 3.00 average.

What do you need to know?
1. What’s my GPA?
2. How well do I have to do on the final to get my grade?
3. How well do I have to do this semester to keep my scholarship?
4. I already know too much. Let me out of here.
Enter your choice: 4

Happy studying!

Formulae

To calculate a grade-point average:
GPA = (hours1 * grade1 + hours2 * grade2 + …) / (hours1 + hours2 + …)

To calculate the exam grade necessary for a certain grade in the class (percentages are assumed to be in the form “90” meaning 90 percent):
Point system:
points_needed = desired_percent*.01*total_points - current_pts

Percentage system:
percent_needed = (desired_percent – current_percent * (1 – exam_percent * .01)) / (exam_percent * .01)

To calculate the necessary current GPA to keep an accumulative GPA above 3.0:
GPA_needed = ( 3 * (current_credits + earned_credits) – GPA_earned * earned_credits) / current_credits

Requirements

You must error-check all user-entered values. This includes making sure that the program won’t crash when the user enters a character instead of an integer, for example.

You must turn in a design document for this assignment. It can be a flow chart, list of steps, bits of code, or whatever you used to help you design the program. The design document will be worth 10 points of the total score.

Don’t forget to turn in your printed source code and test runs, as well as an executable.