Question
2. (15 marks) Follow the following steps: 1) Write a Java class named Circle with integer data member named radius. The class should have two
2. (15 marks) Follow the following steps: 1) Write a Java class named Circle with integer data member named radius. The class should have two constructors, get/set methods, a getArea method, and a toString method; 2) In the test driver class, create a LinkedList object called circleList which can hold Circle objects; 3) Write a method called fillList which has a parameter list for receiving the above circleList and a desired size (e.g. 5). In this method, use a loop to create the desired number of Circle objects with random integer radius value in the range of 1 to 10. Each time a new Circle object is created, it is added to the end of CircleList; 4) Write a method called displayTotalArea which receives the circleList through a parameter. This method steps through the circleList, finds the total area of all Circle objects in it and displays the total area; 5) Test your code and take screenshots. Submit your output screenshots and Java code.
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