Mark44
Mentor
- 38,033
- 10,506
Yes, your random numbers look fine. They're now in the right intervals.
For your other question, the x, y, and radius values don't come from user input - they are generated as random numbers. And yes, each iteration of the loop needs to generate an x, a y, and a radius, then call a Transmitter constructor, passing those values of x, y, and radius in the constructor call.
You're going to have a statement like this inside the loop:
So, network will be a Transmitter object.
network[2].getX() will return the X value for the Transmitter object at index 2 in the array.
network[m].getY() will return the Y value for the Transmitter object at index m in the array.
I think I remember that you have a getRadius() method. It would work the same way.
For your other question, the x, y, and radius values don't come from user input - they are generated as random numbers. And yes, each iteration of the loop needs to generate an x, a y, and a radius, then call a Transmitter constructor, passing those values of x, y, and radius in the constructor call.
You're going to have a statement like this inside the loop:
Code:
// generate random x, y, and radius values
network[i] = new Transmitter(x, y, radius);
So, network will be a Transmitter object.
network[2].getX() will return the X value for the Transmitter object at index 2 in the array.
network[m].getY() will return the Y value for the Transmitter object at index m in the array.
I think I remember that you have a getRadius() method. It would work the same way.