Question: 5 4 . 9 Project: Calculate Weighted GPA LAB 5 4 . 9 . 1 : Project: Calculate Weighted GPA LetterToGPA.java * * * *

54.9 Project: Calculate Weighted GPA LAB
54.9.1: Project: Calculate Weighted GPA
LetterToGPA.java
**** DESCRIPTION OF PROGRAM HERE
Mauthor YOUR NAME HERE
eversion DATE HERE
*/
import java.util.Scanner;
public class LetterToGPA {
public static void main(String \square args){
Scanner input = new Scanner(
System.in);
}
/* Type your code here. */
Write a program that prompts the user for the letter grades and associated credit hours for four classes and output the weighted GPA. The
heed to use the if statement isteger. In order to convert the letter grade to its GPA form, use the code from the LetterToGPA lab. You will
are not checking for irralid input in this project. As the user enters grades and credit hours for four courses, you will want to keep a running
total credit hours
This formula essentialy means that for each class, you take a grade as input (each letter grade will have a corresponding GPA that you
feed to associate with it) and multiply the GPA by the class's credit hours. For instance, if you inpun A and 3, the caloulation would be 4.
3, which would yield 12
Let's take a look at an example below with the following course grades and credit hours as input:
Sample Example
Since we only take four classes as input, we do four different multipications, sum their results, and divide by the total number of creaits
Step 1:
We will compute each multiplication of GPA and cresit hour calculation
ist Muttiplication (Class 1): Input A and 4
Multiplication Result: 4.0*4=12
2nd Mutiplication (Class 2): Input: e- and 2
Multiplication Result: 2.7*2=5.4
3rd Multiplication (Class 3). Input: B and 2
Multiplication Result: 3.0*2=6.0
4th Multiplication (Class 4): Input: C+ and 3
Multiplication Result: 2.3*3=6.9
We will now add these values topether to obtain the rumerator portion of the formuls.
numerator =k=14credit hours ?(()()k) grade's ?(()()') numerical value ?(()()k)=12+5.4+6.0+6.9=30.3
Step 2:
We will now add these values and dvide by the total number of credit hours we have provided as input
Total Credit Hours : 4+2+2+3=11
denominator = total credit hours =11
Step 3:
We will now divide the numerator by the denominator to cotain our final result for our calculated weighted GPA.
numeratordenominator=30.811~~2.7545
All Steps together Using Formula:
GPA=4.04+2.72+3.02+2.334+2+2+3=30.311~~2.7545
Learning objective: To use for loops and iherative variable updates.
Sample Outputs: This is a sample transcript of what your program should da. Make sure your oulput looks EXACTLY ike the outpun below.
Sample un t:
Please insert the letter grades and credit hours for your four classes below once pronpted
Enter the associated oredit hours: 4
Enter a letter grade: B
Enter a letter grades credit hours:
Enter the associated credit hours:
GPA
coodbye!
Sample run 2:
Hints:
You will need to wite a loop to take in all the classes
You will want to keep a string variable that holds the table that you want to print, and every time you loop, you will want to add a nes
table line to the end of that string. You can start a new line with the character "yr". We also use tabs instead of spaces in our table
which can be added by witting "It in your string.
Start with a GPA =0 and add on the weighted GPA for each class.
You can then divide by the total credit hours at the end of your whie loop to get the weighted GPA When you do this, try multiplying
5 4 . 9 Project: Calculate Weighted GPA LAB 5 4 .

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!