The problem I am having is in Juno Eclipse. "school.nextString" is being underlined in red to highlight a critical error. The basic purpose of this program is to ask the user a series of simple questions with if loops to determine the output given. Eclipse is handy and gives me suggestions as to what I should change nextString to, giving me "nextLong" and "toString" as the only fixes. Both of them cause more problems without solving the first one. Here's my code:

package assignment2;

import java.util.Scanner;

public class Assignment2 {
    public static void main(String[] args) {

        String highSchool;
        Scanner school = new Scanner(System.in);
        System.out.println("Did you go to Milford High School, yes or no?");
        highSchool = school.nextString();
        int totalCredits = 0;
        System.out.println("How many credits have you earned?");
        totalCredits = school.nextInt();
        double gpa = 0;
        System.out.println("Do you have a GPA higher than 4.2?");
        gpa = school.nextInt();
        boolean footballPlayer = false;
        System.out.println("Are you a football player?");
        footballPlayer = school.nextBoolean(); {

        if (highSchool.equals("Yes"))
            System.out.println("Go straight to Harvard");
            if (totalCredits < 20)
                System.out.println("Stay in school");
                if (gpa > 4.2)
                    System.out.println("Go to UC");
                    System.out.println("Apply to college");
        if (footballPlayer == true)
                System.out.println("Expect special treatment");


4 Years
Discussion Span
Last Post by Taywin
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.