Assignment #61 Keep Guessing
Code
///Name: Ian Grant
///Period:5
///Project Name: Keep Guessing
///File Name:NumGuessV3.java
///11/10/15
import java.util.Scanner;
import java.util.Random;
public class NumGuessV3
{
public static void main(String[] args)
{
Scanner stuff=new Scanner(System.in);
Random Rstuff=new Random();
int gus,ans;
ans= 1+Rstuff.nextInt(10);
System.out.println("teh worst number gessing gaaame evar!!");
System.out.print("I'm thinking of a number between 1 and 10. Try to guess it! ");
gus=stuff.nextInt();
while (gus != ans)
{
System.out.println("That is incorrect. Guess again.");
gus=stuff.nextInt();
}
System.out.println("That's correct! You're a good guesser");
}
}
Output