Question: JAVA program please Write a class called MyRandom, that make additional methods to extend on the native Random Class. You will need to write two
JAVA program please
Write a class called MyRandom, that make additional methods to extend on the native Random Class.
You will need to write two methods. Method 1: nextReal(int bound)
This method returns a double from 0 to bound, it will include any number including fractional parts.
For Example MyRandom myRand = new MyRandom(); System.out.println(myRand.nextReal(5))
---Console--- 3.67859
Method 2: nextDollar()
This method will return a double between 1 and 2, with only 2 decimal places. (Rarely double will occasionally have a really small decimal value EG. 1.34000000000002 It is okay if this happens)
For Example,
MyRandom myRand = new MyRandom(); System.out.println(myRand.nextDollar());
---Console--- 1.45
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
