Can't remove a line from the code?
<p>The application is a number guessing game my problem is when the user get the random number right, it ask the user would you like to continue if he types in "y" it creates a new random number and asks the user to guess it. it then should ask the user "enter a number". instead i get</p>

<p>"too high" (or "too low")<br>
"enter the number"</p>

<p>ex output:<br>
Enter the Number:<br>
2<br>
Correct you've got it! The Number Was 2
You got it in 2 tries.<br>
Would you like to play again (y/n):<br>
y<br>
Too low! Try again.<br>
Enter the Number:  </p>

<p>how do i get it to just as the question without printing the "too high" or "too low" which is suppose to be determined after he enter a number???</p>

<p>ps. I tried many ways but am stuck:(</p>

<pre><code>public static void main(String[] args) {
    System.out
            .println("Welcome to the gussing game, Try to guess the number am thinking of to win!");
    System.out
            .println("++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++");
    System.out.println();

    System.out
            .println("Am thinking of a number between 0 and 10. Try to guess it.");
    System.out.println();

    Scanner sc = new Scanner(System.in);
    String choice = "y";

    double rightNum = Math.random() * 10;
    int randomNum = (int) rightNum; // convert the random number to int
    int tries = 0;

    while (!choice.equalsIgnoreCase("n")) {

        System.out.println("Enter the Number:");
        int guess = sc.nextInt();
        tries++;

        if (guess == randomNum) {
            System.out.println("Correct you've got it! The Number Was "
                    + randomNum);
            System.out.println("You got it in " + tries + " tries.");
            System.out.println("Would you like to play again (y/n):");
            choice = sc.next();

            if (choice.equalsIgnoreCase("y"))
            // reset the random number

            {
                rightNum = Math.random() * 10;
                randomNum = (int) rightNum;
                tries = 0;

            }
        }

        if (guess &gt; randomNum + 10) {
            System.out.println("Way to high! Try again.");
        } else if (guess &lt; randomNum) {
            System.out.println("Too low! Try again.");
        } else if (guess &gt; randomNum &amp;&amp; guess &lt;= randomNum + 10) {
            System.out.println("Too high! Try again.");
        }

    }

}
</code></pre>

<p>}</p>
