Assignemnt #58
Code
/// Name: Holden Ganch
/// Period: 7
/// Program Name: fifty eigth Program
/// File Name: HighLow.java
/// Date Finished: 11/16/2015
import java.util.Random;
import java.util.Scanner;
public class HighLow
{
public static void main ( String[] args )
{
Random r = new Random();
Scanner keyboard = new Scanner(System.in);
int y, x = 1 + r.nextInt(100);
System.out.println("I'm thinking of a number between 1-100. Lets test your guessing skills");
System.out.print("> ");
y = keyboard.nextInt();
if ( x == y)
{
System.out.println("Woah thats crazy you got the number correct, it WAS " + x);
}
if ( x > y )
{
System.out.println("Your digts were to low increase them and you would have got it, it was " + x);
}
if ( x < y )
{
System.out.println("Sorry you guessed to hish it was " + x);
}
}
}
Picture of the output