Question: 5 4 . 1 1 LAB: Extending Gradebook with Methods Using the letter to GPA program that you wrote in project two, this lab extends
LAB: Extending Gradebook with Methods
Using the letter to GPA program that you wrote in project two, this lab extends the previous lab on creating a gradebook using arrays. Similarly, the program asks how many classes the user has, and then takes the name of the class, the grade, and the number of credit hours for each class. The program prints out a table showing the GPA associated with each letter grade, the credits, the final weighted GPA, and total credit hours.
In this lab, you will write two methods in the main class. The first method is to convert a letter grade to a GPA value. The second method calculating the weighted GPA of all classes.
Learning Objective: How to create userdefined methods
Sample Outputs:
What i have so far: import java.util.Scanner; import java.util.Arrays; public class Main public static void mainString args Scanner input new ScannerSystemin; TODO: assemble code and print output System.out.printlnPlease enter the number of classes you have: ; String numberString input.nextLine; int numClasses Integer.parseIntnumberString; String classesTotal new String numClasses; int gradeTotal new int numClasses; int creditTotal new int numClasses; forint i ; i numClasses; i System.out.printlnPlease enter class i "name: ; classesTotali input.nextLine; System.out.printlnPlease enter class i "grade: ; gradeTotali input.nextLine; System.out.printlnPlease enter class i "credit hours: ; String creditStr input.nextLine; creditTotali Integer.parseIntcreditStr; System.out.printlnclasses public static double GradeToGPAString gradeTODO: convert letter grade to numeric GPA value double gpa ; ifgradeequalsA gpa ; else ifgradeequalsA gpa ; else ifgradeequalsB gpa ; else ifgradeequalsB gpa ; else ifgradeequalsB gpa ; else ifgradeequalsC gpa ; else ifgradeequalsC gpa ; else ifgradeequalsC gpa ; else ifgradeequalsD gpa ; else ifgradeequalsD gpa ; else ifgradeequalsE gpa ; elseSystemout.printlngrade is not a valid letter grade."; return gpa; public static double getGPAint numClasses, String grades, int creditsTODO: calculate total GPA of student double totalGpa ; forint i ; i ; i return ;
Example :
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
