Question: in java script, only importing scanner CSCI 1933 LAB 2 1. WHAT'S MY GPA? Calculating GPA Ok, now you're ready to write a GPA calculator!

CSCI 1933 LAB 2 1. WHAT'S MY GPA? Calculating GPA Ok, now you're ready to write a GPA calculator! Students and advisors commonly need to find the GPA for specific groups of courses takon. Examples include finding the technical GPA or the GPA for prerequisite courses for a specific major. Your Java program should take in letter grades and credit hour pairs from the command line and compute the GPA. In your main method, you need to prompt the user for their input, purse their Input, and calculate their GPA. Use the following chart for grade point values: Grade Grade Points 4.0 A- 3.667 B+ 3.333 B 3.0 B- 2.667 C+ 2.333 2.0 LOSOS D+ 1.667 1.333 1.0 0.0 F You can assume that credit hours are always whole integer, Hint: Writing a helper method to convert from letter to numeric grades may be helpful (this can be called from your main method) Some example of how your program should run follow > Jaya GPA > Enter grades a 4 4 2 2 - 4 > The GPA 101 3.33 > Java GPA > Enter grades: A4 > The GPA is: 4 > Java GPA > Enter grades: CSCI 1933 LAB 2 2. WRITE A RATIONAL NUMBER CLASS c- 4 b+ 4 a 3 > The GPA 18: 2.91 > java GPA > Enter grades: c4d 1 a 3 b+ 4 a 4 > The GPA is: 3.145 To calculate GPA, use the following method: (grade, credit) credit, For example, if you enter java GPA a 4 b- 3 c+ 2 your calculation would be: (4.0 x 4) + (2.667 X 3) + (2.333 x 2) C = 3.185 If the user enters input in an incorrect format or using an incorrect grade symbol, your code should exit with the following error message: "Error: Incorrect input format!" > java GPA > Enter grades: c4dd 2 > Error: Incorrect input format! > java GPA > Enter grades: & 4 a 3 b 2 > Error: Incorrect input format! Hint: Note that the Scanner class has a number of methods for checking what type of input is in the next token (for example, hasNextInt()), which you'll find useful for solving this problem. Milestone 1: Run your GPA class from the command line using the examples shown above, and show us your own tests. Are there any cases when your solution fails
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
