Assignemnt #61 and Keep Guessing
Code
/// Name: Raff Lisbona
/// Period: 6
/// Program Name: Keep Guessing
/// File Name: KeepGuessing.java
/// Date Finished: 11/19/2015
import java.util.Scanner;
public class KeepGuessing
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
int number = 2;
int guess;
System.out.println("I chose a number between 1-10. Try to guess it.");
System.out.print("Your guess: ");
guess = keyboard.nextInt();
while ( guess != number )
{
System.out.println("That is incorrect. Guess again.");
System.out.print("Your guess: ");
guess = keyboard.nextInt();
}
System.out.println("That's right! You're a good guesser.");
}
}
Picture of the output