All pastes #2070701 Raw Edit

Someone

public text v1 · immutable
#2070701 ·published 2011-05-28 04:20 UTC
rendered paste body
package assi2question1;
import java.lang.*;
import java.util.Scanner;
public class Assi2question1 {
 
    public static void main(String[] args) {
        int random, userInput;
       
        userInput = -1;
        random = (int)(100.0 * Math.random());
       
        System.out.println(random);
       
        Scanner keyboard = new Scanner(System.in);
       
        System.out.println("Guess an integer number between 0 and 100");
       
       
       
        while (random != userInput)  {
           userInput = keyboard.nextInt();

           
            if (userInput < 0) {
                System.out.println(userInput + " is low. Please enter a number >= 0");
            }
            else if (userInput > 100) {
                System.out.println(userInput + " is high. Please enter a number <= 100");
            }
            else{
                System.out.println(userInput + " is not the number I guessed. Guess again.");
            }
        }
       
        System.out.println("Congratulations," + random + " is the number I picked.");
}
}