Hello! Exercise: Write a class called RandomGeneratorImproved that expands RandomGenerator, which is able to generate random numbers coming from the sets of: a. first numbers, b. powers of 2(not negative int), c. Fibonacci numbers and d. square numbers. Create 2 new methods that are similar to "nextInt" method like (public int nextPrime(int n)) and public int nextPrime(int low, int high)). If there is no prime number in that range, it should show a message saying that and return -1. In the same way you should do all the methods for a., b., c., d. Write a program to test it where the user asks for what kind of random number he wants and within what range (low, high) and the result of it is a RANDOM number. Do not use ARRAYS or any method that saves the numbers in lists. Thank you in advance!
The answer to the question is available in the PDF file https://assignmentexpert.com/https://assignmentexpert.com/homework-answers/programming-answer-57120.pdf
Comments
Leave a comment