Question: Write a method called generate, which generates n random numbers in the range [a,b], where n, a, and b are inputs to the method and

 Write a method called generate, which generates n random numbers in

Write a method called generate, which generates n random numbers in the range [a,b], where n, a, and b are inputs to the method and are integers. The method displays all generated numbers on one line and then displays "done" on next line. Run example: Assume we asked the method to generate 10 random numbers in the range [1,4], then it displays 3,4,1,2,3,3,2,2,2,1 done Note that there is no comma after the last displayed number. Validation: a should be less than b, otherwise, the function displays "invalid range" n should be larger than 0, otherwise, the function will by default produce 10 numbers. Method generate can be directly called from the main method

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!