Question: In this assignment you will implement a class with attributes ( aka data fields ) and methods. Follow these guidelines ( in Java ) :
In this assignment you will implement a class with attributes aka data fields and methods. Follow these guidelines in Java:
Name the class MyCircle
Declare private double properties named x y and radius. The x and y attributes represent the center of the circle, and the radius defines the radius of the same circle object.
Implement constructors:
i The default constructor creates a circle object center at and has radius
ii Overloaded constructor that accepts double argument used to define a circle's radius, and default center at
iii. Overloaded constructor that accepts double arguments to define the center point coordinates, and sets the radius to the default value.
iv Overloaded constructor that accepts double arguments that initializes the center point coordinates and the radius of the circle object with the given values, the arguments should be in this order: x y radius respectively.
Implement getter methods for each of the private data fields.
Implement setter methods for each of the private data fields.
Implement the containsdoubnle x double y method. It returns true if the given xy arguments are inside the circle object, false otherwise.
Make sure that the radius property of the circle can never be less than or equal to zero
i In the constructors make sure that if the given radius value is less than or equal to that it sets radius to the default value instead
ii In the radius setter, make sure the value does NOT change if the given value is or negative.
Boilerplate code:
public class MyCircle
AttributesData fieldsProperties
YOUR CODE HERE
Constructors
Circle
YOUR CODE HERE
Circle add expected arguments here if needed
YOUR CODE HERE
Circle add expected arguments here if needed
YOUR CODE HERE
Circle add expected arguments here if needed
YOUR CODE HERE
Methods
Getters and Setters
public add appropriate return type setRadius add expected arguments here if needed
YOUR CODE HERE
public add appropriate return type getRadius add expected arguments here if needed
YOUR CODE HERE
public add appropriate return type setX add expected arguments here if needed
YOUR CODE HERE
public add appropriate return type getX add expected arguments here if needed
YOUR CODE HERE
public add appropriate return type setY add expected arguments here if needed
YOUR CODE HERE
public add appropriate return type getY add expected arguments here if needed
YOUR CODE HERE
Other helpful methods
public add appropriate return type containsdouble x double y
YOUR CODE HERE
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
