Question: Java: Using random numbers and logical operators write a program that meets the following requirements. Do NOT use if statements. Generate numbers: Generate and store

Java: Using random numbers and logical operators write a program that meets the following requirements. Do NOT use if statements.

Generate numbers:

  • Generate and store a random single digit integer ( in the range 0 - 9 )
  • Generate and store random two digit integer ( in the range 10 - 99 )
  • Output the two numbers generated.

Determine the following facts about the numbers using boolean variables to store the result of a compound expression that uses a logical operator. Do NOT use if statements.

Output the questions and the value in the boolean variable for each question.

  1. Are the numbers both odd?

  2. Are the numbers both even?
  3. Is one number even and the other number odd?
  4. Are both numbers a multiple three?
  5. Is at least one of the numbers a multiple of three?
  6. Is one or the other of the numbers a multiple of three, but not both?
  7. Is the first number one of the digits in the second number?
  8. Are all of the digits in both numbers unique? (meaning each of the three digits are different)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!