Assignment #58 One Shot High Low
Code
/// Name: Lacey Reese
/// Period: 5
/// Program Name: OneShotHighLow
/// File Name: OneShotHighLow.java
/// Date Finished 11/25/2015
import java.util.Scanner;
import java.util.Random;
public class OneShotHighLow
{
public static void main( String[] args )
{
Scanner keyboard = new Scanner(System.in);
Random r = new Random();
int Number, Guess;
Number = 1 + r.nextInt(100);
System.out.println( "I'm thinking of a number between 1-100. Try to guess i!!!!!t" );
System.out.print( "> " );
Guess = keyboard.nextInt();
System.out.println();
if ( Guess == Number )
{
System.out.println( "You guessed it! WOW you are amazing" );
}
else if ( Guess > Number )
{
System.out.println( "Sorry, you are too high :( I was thinking of " + Number + "." );
}
else if ( Guess < Number )
{
System.out.println( "Sorry, you are too low :/ I was thinking of " + Number + "." );
}
else
{
System.out.println( "LOl you suck." );
}
}
}
Picture of the output
//