Assignemnt #58: One Shot Hi-Lo
Code
///Name: Cassie
///Period: 6
///Program Name: One Shot High Low
///File Name: shot.java
///Date Finished: 12/3/15
import java.util.Random;
import java.util.Scanner;
class PlzGuess
{
public static void main ( String[] args )
{
Random r = new Random();
Scanner keyboard = new Scanner(System.in);
int guess, ans = 1 + r.nextInt(100);
System.out.print( "Pick a number between 1-100: " );
guess = keyboard.nextInt();
if ( guess == ans )
System.out.println( "hahaahaaa u got it right kid B^)" );
else if ( guess < ans )
System.out.println( "You're so low! I was thinking of " + ans );
else if ( guess > ans )
System.out.println( "You're high. I was thinking of " + ans );
}
}
Picture of the output