Assignemnt #58 and One Shot Hi-Lo
Code
///Name: Dakota Donahue
///Period: 5
///Project Name: One Shot Hi-Lo
///File Name: OneShot
///Date: 12/4/2015
import java.util.Scanner;
import java.util.Random;
public class OneShot
{
public static void main ( String[] args )
{
int gS;
Scanner keyboard = new Scanner(System.in);
Random r = new Random();
int cN = 1 + r.nextInt(100);
System.out.println( " I'm thinking of a number between 1-100. Try to guess it. ");
gS = keyboard.nextInt();
if ( gS == cN )
{
System.out.println( " You guessed it! What are the odds! " );
}
else if ( gS < cN )
{
System.out.println( " Sorry, your guess was too low. " );
}
else if ( gS > cN )
{
System.out.println( " Sorry, your guess was too high. " );
}
}
}