Question: A Circle may be represented as three floating point values. One value represents the change in X, another represents the change in Y, and the
A Circle may be represented as three floating point values. One value represents the change in X, another represents the change in Y, and the last value represents the radius. In addition, each Circle also has a color value which is either Red, Green, or Blue. Write a class to represent Circles. The class should have only one constructor which takes the four values as parameters. The class should also provide get methods for each of the data member variables.
Add a method to the Circle class definition which calculates the area of a Circle.
Add a method to the Circle class definition which returns true if the Circle is the specified color and false otherwise.
Write a static method in a Class called CircleUtils which when given an ArrayList of Circle objects as a parameter, calculates the total area of all the Circle objects in the ArrayList.
Add a static method to the CircleUtils class which takes an ArrayList of Circle objects as a parameter and a String representing a color. The method should return the Circle with the largest area and the specified color.
Write a toString() method for the Circle class.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
