CS 6752 Homework 4
Due: Tuesday, October 18 at 1:30 pm

Assignment 4: Calculate your GPA

This HW will introduce you to Java programming. In it, you'll write a program that calculates a GPA based on Georgia Tech's "Quality Point" system. To do so, one multiplies the number of credit hours by the value of the grade received for each class, and divide the total value by the total number of credit hours one has taken. Who knows, maybe this calculator will be useful for you in the future.

Written as a math formula, the total number of quality points earned is calculated by:

 (4.0 * numACreditHours) + (3.0 * numBCreditHours) + (2.0 *numCCreditHours) + (1.0 * numDCreditHours) + (0.0 * numF CreditHours)

where numACreditHours is the number of credit hours earned with a grade of A and so on. GPA is then the total number of quality points divided by the sum of the credit hours. (We won't worry about pass/fail courses.)

In your program, you'll need to prompt the user for the total number of credit hours received for each letter grade. You then calculate and return the correct GPA. After making a calculation, ask the user if they'd like to do another. You can assume for this assignment, we will only make valid inputs to your program (positive integers). A sample output for your program is below (note the credit hour numbers are user input, GPA is returned by your program):

Enter the different credit hours below.

A Credit Hours: 4
B Credit Hours: 4
C Credit Hours: 0
D Credit Hours: 0
F Credit Hours: 0

The GPA for that student is 3.5

Would you like to calculate another GPA? (y/n)
y

A Credit Hours: 3
B Credit Hours: 9
C Credit Hours: 15
D Credit Hours: 6
F Credit Hours: 3

The GPA for that student is 2.09

Would you like to calculate another GPA? (y/n)
n
Notes & Hints:
  • Look over the slides from last week and the example programs to get ideas and tips about how to accomplish the assignment objectives.

    Turn-in Procedures

    After you have finished the above assignment, turn it in via T-Square. Please name your file GPACalc.java.