troubleshooting Question

Java

Avatar of PlanAndSimple
PlanAndSimpleFlag for United Kingdom of Great Britain and Northern Ireland asked on
Java
6 Comments3 Solutions320 ViewsLast Modified:
Hi hoping someone can help witha little bit of java programming. Very new to java and keep getting the following errors

--------------------Configuration: <Default>--------------------
F:\GuessingGameExer4.java:42: cannot find symbol
symbol  : method println(java.lang.String,int)
location: class java.io.PrintStream
    System.out.println("Random Number is ", secretNumber);
              ^
F:\GuessingGameExer4.java:44: cannot find symbol
symbol  : variable input
location: class GuessingGame
    while(input.equals("y"));
          ^
F:\GuessingGameExer4.java:46: cannot find symbol
symbol  : variable input
location: class GuessingGame
    if(input.equals("n"));
       ^
3 errors

Process completed.
import java.util.*;
import java.io.*;
 
class GuessingGame {
    
    private char response;
    private int secretNumber;
    private Scanner scan;
    
    public static final int MAX_GUESSES = 6;
    public static final int LOWER_BOUND = 0;
    public static final int UPPER_BOUND = 100; 
    
    
    public static void main(String[] args) throws IOException 
    	{
    	System.out.println("Welcome to the Guessing Game!");
    	GuessingGame hiLo = new GuessingGame();
    	hiLo.start();
    	}
        
    public void start()
    {
   do{
   
    String input; //Local variable within this method only
    scan = new Scanner(System.in); //Creates Scanner instance
    System.out.print("Do you want to play a game (y/n)?");
    input = scan.next(); 
    
    int randomNumber = new Random().nextInt(UPPER_BOUND);
    secretNumber = randomNumber;
    System.out.println("Random Number is ", secretNumber);
    }
    while(input.equals("y"));
	
	if(input.equals("n"));
	System.exit(0);
    }
ASKER CERTIFIED SOLUTION
Join our community to see this answer!
Unlock 3 Answers and 6 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 3 Answers and 6 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros