Solved

Write a Method Called RandomInRange That Takes in Two Numbers

Question 19

Short Answer

Write a method called randomInRange that takes in two numbers representing a range. Print an error message and return zero if the second parameter is less than the first. Otherwise, the method should return a randomly generated integer in that range (inclusive). You may assume that the class has a static Random object called generator already declared and instantiated.

Correct Answer:

verifed

Verified

public int randomInRange(int a...

View Answer

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions