Assignment #55 A Number-Guessing Game
Code
///Name: Ian Grant
///Period:5
///Project Name: A Number-Guessing Game
///File Name:NumGuessV2.java
///11/6/15
import java.util.Scanner;
import java.util.Random;
public class NumGuessV2
{
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();
if (gus==ans)
{
System.out.println("That's correct, it is "+ans);
}
else
System.out.println("Wrong it was "+ans);
}
}
Output