0
import java.util.Scanner;
public class GpaConverterTester
{
public static void main(String[] args)
{
    Scanner sc = new Scanner(System.in);
    GpaConverter g = new GpaConverter();

    System.out.println("How many classes are you taking? ");
    int classAmount = sc.nextInt();
    while(classAmount > 0)
    {
        System.out.println("Enter Grade: ");
        String grade = sc.nextLine();
        g.setGpaValue(grade);
        classAmount--;
    }
    System.out.println("Average: " + g.getAverage());

}
}

My basic problem is that it wont let me enter in the grade string. This is what happens...

Output: "How many classes are you taking? 2 Enter Grade: Enter Grade: " It does not let me enter in the grade string. Thank you for helping!

Michael
  • 39
  • 3

1 Answers1

1

I figured it out.

Use sc.next() instead of line.

Michael
  • 39
  • 3