Question
Java: Implement a RandomInteger class. Your data members would be: private int min; private int max; private int range; // compute only when min/max change
Java:
Implement a RandomInteger class. Your data members would be: private int min; private int max; private int range; // compute only when min/max change The class should have a default constructor, and a parametric constructor for this: public RandomInteger() // min = 0, max = 1 public RandomInteger(int min, int max) The class should have getters and setters for min, and max. The class should have a Generate() method that returns a random integer number in the range from min to max. public int Generate()
Use the keyword 'this' to refer to data members in methods.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started