Assignemnt #58 - Hilo

Code

    /// Name: Caelan Dorstad
    /// Period: 6
    /// Program Name: Hilo
    /// File Name: Hilo.java
    /// Date Finished: 10/30/2015
    
    
   import java.util.Random;
    import java.util.Scanner;;
    
    public class Hilo{
        public static void main(String[] args){
            
            Scanner keyboard = new Scanner(System.in);
            Random r = new Random();
            
            int a,num = 1 + r.nextInt(100);
            
            System.out.print("Guess a number 1 - 100");
            System.out.println("> ");
            a = keyboard.nextInt();
            
            if (a == num){
                System.out.print("right! it was" + num + " !!!!!");
            }
            else {
                System.out.println("nah it was " + num + ".");
            }
        }
    }
        
    

Picture of the output

Assignment 39