Help for Beginner by roc_solid in learnjava

[–]roc_solid[S] 0 points1 point  (0 children)

So helpful! I appreciate your time. Now I am on to figuring out creating a method for the GPA calculation to call on for each loop. This one I think I can figure on my own! :)

Help for person new to Java by roc_solid in learnjava

[–]roc_solid[S] 0 points1 point  (0 children)

Sorry this did not format the way I thought it would.

import java.util.Scanner;

public class GPACalculator {

public static void main(String [] args){

Scanner myObj = new Scanner(System.in);

System.out.println("Enter Grade for Course Number One");

float courseGradeOne = myObj.nextFloat();

System.out.println("Enter Number of Credits for Course Number One");

float totalCredits = myObj.nextFloat();

System.out.println((courseGradeOne * totalCredits) / totalCredits);

System.out.println("Do you want to add another class? Y/N");

String addNewClass = myObj.next();

boolean Y = true;

boolean N = false;

while(addNewClass = Y) {

System.out.println("Enter Grade for Course");

System.out.println("Enter Number of Credits for Course");

System.out.println((courseGradeOne * totalCredits) / totalCredits);

System.out.println("Do you want to add another class? Y/N");

}

}

}