Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Create a Java program in eclipse calucating GPA of a student. Could use assitatn

ID: 3819142 • Letter: C

Question

Create a Java program in eclipse calucating GPA of a student. Could use assitatnce in creating this doing the following:

The program will gather all the information to calculate a student’s semester G.P.A and display the courses, grades received and the G.P.A of that student using the JOptionPane and parseing the data as needed in the program.

Syntax of the program:

Ask the user to enter their name

Ask the user to enter the name of the class, number of credit hours for the class and the letter grade received.

Calculate the weighted grade for the course by multiplying the credit hours for the course by the numeric equivalent of the grade.

Have the program calculate the total number of credit hours.

Have the program calculate the total of the weighted grades.

Write the information entered to a file named: results.txt (which the file should show class name, the credits and the grade along with the total GPA. )

Repeat this in a loop until they have no more classes to enter

All data entered must be validated

When all classes are entered the G.P.A should be calculated and written to the file.

Letter grade and grade point

A is 6

A- is 5.7

B+ is 5.5

B is 5

B- is 4.5

C+ is 4

C- is 3.5

D+ is 3

D is 2

D- 1

F is 0

Explanation / Answer

“import java.util.Scanner; public class StudentGPA { public static void main (String args[]){ String grade = ""; double credit1; double credit2; double credit3; double credit4; double gradeValue=0; double totPtsClass1=0; double totPtsClass2=0; double totPtsClass3=0; double totPtsClass4=0; double totPts=0; double totalCredits= 0; double gpa; Scanner console = new Scanner (System.in); System.out.println("Please enter the number of credits of the class 1 (A number)"); credit1 = console.nextDouble(); System.out.println("Please enter your grades for the class 1(Capital letters such as A,B+, C-)"); grade = console.next(); if (grade.equals ("A")) gradeValue= 4.00; else if (grade.equals("A-")) gradeValue= 3.67; else if (grade.equals("B+")) gradeValue = 3.33; else if (grade.equals("B")) gradeValue = 3.00; else if (grade.equals ("B-")) gradeValue = 2.67; else if (grade.equals("C+")) gradeValue = 2.33; else if (grade.equals("C")) gradeValue = 2.00; else if (grade.equals ("D+")) gradeValue = 1.33; else if (grade.equals ("D")) gradeValue = 1.00; else if (grade.equals ("F")) gradeValue = 0; else if (grade.equals ("FX")) gradeValue = 0; else System.out.println ("Invalid Grade"); totPtsClass1 = gradeValue * credit1; System.out.println("Please enter the number of credits of the class 2 (A number)"); credit2 = console.nextDouble(); System.out.println("Please enter your grades for the class 2 (Capital letters such as A,B+, C-)"); grade = console.next(); if (grade.equals ("A")) gradeValue= 4.00; else if (grade.equals("A-")) gradeValue= 3.67; else if (grade.equals("B+")) gradeValue = 3.33; else if (grade.equals("B")) gradeValue = 3.00; else if (grade.equals ("B-")) gradeValue = 2.67; else if (grade.equals("C+")) gradeValue = 2.33; else if (grade.equals("C")) gradeValue = 2.00; else if (grade.equals ("D+")) gradeValue = 1.33; else if (grade.equals ("D")) gradeValue = 1.00; else if (grade.equals ("F")) gradeValue = 0; else if (grade.equals ("FX")) gradeValue = 0; else System.out.println ("Invalid Grade"); totPtsClass2 = gradeValue * credit2; System.out.println("Please enter the number of credits of the class 3 (A number)"); credit3 = console.nextDouble(); System.out.println("Please enter your grades for the class 3 (Capital letters such as A,B+, C-)"); grade = console.next(); if (grade.equals ("A")) gradeValue= 4.00; else if (grade.equals("A-")) gradeValue= 3.67; else if (grade.equals("B+")) gradeValue = 3.33; else if (grade.equals("B")) gradeValue = 3.00; else if (grade.equals ("B-")) gradeValue = 2.67; else if (grade.equals("C+")) gradeValue = 2.33; else if (grade.equals("C")) gradeValue = 2.00; else if (grade.equals ("D+")) gradeValue = 1.33; else if (grade.equals ("D")) gradeValue = 1.00; else if (grade.equals ("F")) gradeValue = 0; else if (grade.equals ("FX")) gradeValue = 0; else System.out.println ("Invalid Grade"); totPtsClass3 = gradeValue * credit3; System.out.println("Please enter the number of credits of the class 4 (A number)"); credit4 = console.nextDouble(); System.out.println("Please enter your grades for the class 4 (Capital letters such as A,B+, C-)"); grade = console.next(); if (grade.equals ("A")) gradeValue= 4.00; else if (grade.equals("A-")) gradeValue= 3.67; else if (grade.equals("B+")) gradeValue = 3.33; else if (grade.equals("B")) gradeValue = 3.00; else if (grade.equals ("B-")) gradeValue = 2.67; else if (grade.equals("C+")) gradeValue = 2.33; else if (grade.equals("C")) gradeValue = 2.00; else if (grade.equals ("D+")) gradeValue = 1.33; else if (grade.equals ("D")) gradeValue = 1.00; else if (grade.equals ("F")) gradeValue = 0; else if (grade.equals ("FX")) gradeValue = 0; else System.out.println ("Invalid Grade"); totPtsClass4 = gradeValue * credit4; totPts= totPtsClass1+totPtsClass2+totPtsClass3+totPtsClass4; totalCredits = credit1+credit2+credit3+credit4; gpa= totPts / totalCredits; System.out.printf("Your GPA is: %.2f ", + gpa); } }”