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; idxRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.