Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Assume we have a Circle class (no need to write the Circle class) with a center

ID: 3655345 • Letter: A

Question

Assume we have a Circle class (no need to write the Circle class) with a center x,y and a radius r all as double type fields, along with set and get methods for the fields. Write a program to make an array of 100 Circle objects using random values for the x,y and r of each Circle in a range 0 to 500. Write a method which will print out the details of x,y,r for each of the Circle objects. Call the method from main. Explain with a memory diagram the locations of all the variables. Explain how the program works in terms of the memory diagram.

Explanation / Answer

import java.util.Random; public final class RandomInt { public static void main(String Args[]){ double x[]=new double[100]; double y[]=new double[100]; double r[]=new double[100];; Random ran = new Random(); for (int idx = 1; idx