Question: 5 4 . 9 Project: Calculate Weighted GPA LAB 5 4 . 9 . 1 : Project: Calculate Weighted GPA LetterToGPA.java * * * *
Project: Calculate Weighted GPA LAB
: 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 mainString 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 the caloulation would be
which would yield
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 :
We will compute each multiplication of GPA and cresit hour calculation
ist Muttiplication Class : Input A and
Multiplication Result:
nd Mutiplication Class : Input: e and
Multiplication Result:
rd Multiplication Class Input: B and
Multiplication Result:
th Multiplication Class : Input: C and
Multiplication Result:
We will now add these values topether to obtain the rumerator portion of the formuls.
numerator credit hours grade's numerical value
Step :
We will now add these values and dvide by the total number of credit hours we have provided as input
Total Credit Hours :
denominator total credit hours
Step :
We will now divide the numerator by the denominator to cotain our final result for our calculated weighted GPA.
~~
All Steps together Using Formula:
GPA~~
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:
Enter a letter grade: B
Enter a letter grades credit hours:
Enter the associated credit hours:
GPA
coodbye!
Sample run :
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 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
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
