Tuesday, August 16, 2011
Java Programming Challenge. Generating random 100 numbers, storing them...etc?
Create a Java program called FindThatNumber. java. The program should generate 10 random integers between 1 and 100 (inclusive) using Math.pow( ) and then store them sequentially in an array. The program should then ask the user to enter a single integer. If the integer is in the array just entered, the program should respond "Bingo!"; otherwise, the program should respond "Sorry". The program should continue running until the user enters -999 to quit. (Hint: The code (int) (100 * Math.random( ) + 1) creates the required random number.)
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment