Java Code/Program - Random Number Generator, While, If/Else Loops, or Operator
by matt392 in Circuits > Software
88 Views, 1 Favorites, 0 Comments
Java Code/Program - Random Number Generator, While, If/Else Loops, or Operator
Java code/program that does the following:
- Asks the user to enter a number between 1 and 10.
- Checks to make sure that the number entered was between 1 and 10.
- If it is not between 1 and 10, it asks the user to enter it again.
- Then the program generates a number between 1 and 10 using the Java Random class.
- Program compares the number that was generated to the number that was entered by the user.
- If the number generated by the program does not match the one entered by the user, the program generates another number and then runs the comparison again.
- Once the number generated by the program is equivalent to the number that was entered by the user, the program informs the user that there is a match and the program terminates.