# [Unlocked] 2 ≤ Radius2

[Unlocked] 2 ≤ Radius2

Homework #6 – CSC110AB (Java)Basics of classesDue: Friday, April 29 (at midnight)Points: 25 (+5 Extra Credit)Requirements:1. As per usual, be sure to leave some comments (in your code) on how certain complex / unique parts of your program work.2. Be sure to follow the instructions outlined [below] for each class / function EXACTLY as described. This includes small things such as making sure your methods are defined with the right names, using the appropriate / necessary data type for your parameter(s) / return type, etc.3. Your final solution should NOT have any print statements anywhere in either file. You can of course utilize print statements to test your code / numbers as your developing this program, just be sure to delete them once you’re done. Also, what you have (or don’t have) in your main method will NOT affect your grade since all I care about are your [two] classes.Tips:1. Be sure to complete “step 1” before moving on to “step 2”; as the class described in step 2 is dependent on the class made during step 1.2. You may notice that the formulas for the “intersect()” functions share a common aspect, so I recommend creating a function to deal with that portion of the needed calculation. Maybe make it a static function in class ‘Point’ which works with two ‘Point’ parameters. Think about it.3. If you’re unsure about a particular aspect the I didn’t go over or purposely left vague for you to figure out on your own, yet you can’t, feel free to contact me with your questions.4. Be sure to test your classes function-by-function as you’re developing your program and NOT all at once at the end.STEP 1: Create a class called ‘Point’ with the following specifications.NOTE: Nothing within this class should be private. Also these should NOT be static.Attributes: A double variable called “X” A double variable called “Y”Constructors: A default constructor which will initialize the ‘X’ and ‘Y’ fields with zero. A “Point(double, double);” constructor that’ll assign the parameters’ values into the ‘X’ and ‘Y’ fieldso { 1st parameter => X & 2nd parameter => Y }————————————————————————————————————STEP 2: Create a class called ‘Circle’ with the following specifications.NOTE: Nothing within this class should be private. Also these should NOT be static.Attributes: A double variable called “radius” A Point object called “center” o HINT: (refer back to lecture on Aggregation)Constructors: A default constructor which will initialize the ‘radius’ field with zero.o NOTE: Make sure that ‘center’ is initialized with a “(0, 0) point” here. A “Circle(double);” constructor that’ll assign the parameter’s value into the ‘radius’ field.o REQUIREMENT: You MUST invoke the class’ own mutator method to handle this assignment.o NOTE: Make sure that ‘center’ is initialized with a “(0, 0) point” here. A “Circle(Point, double);” that’ll assign the parameters into their respective fields.o REQUIREMENT: You MUST invoke the class’ own mutator method to handle the assignment operation for ‘radius’. Methods: A mutator function, for attribute ‘radius’, called “setRadius”.o REQUIREMENT: Make sure that if the parameter’s value is negative, then the assigned value should be zero instead. A function, with NO parameters, called “getArea” which (as the name implies) will calculate and return what the area of our Circle is. Formula: (PI * R ^ 2)o NOTE: You can simply use the value of 3.14159 for ‘PI’. A function, with NO parameters, called “getCircumference” which (as the name implies) will calculate and return what the perimeter of our Circle is. Formula: (2 * PI * R)o NOTE: You can simply use the value of 3.14159 for ‘PI’. A function called “intersect” with a ‘Point’ parameter which will return true if the argument lies within the Circle’s area (including the edge), otherwise it’ll return false.o TIP: The easiest way to figure this out is to compare the lengths of the radius and the distance between the two Points. If you don’t know how to calculate a square root, here’s an alternate formula you can use: (p2.Y − p1.Y)2 + (p2.X − p1.X)2 ≤ radius2 EXTRA CREDIT: An overloaded “intersect” function with a ‘Circle’ parameter which will return true if the argument intersects with this Circle object (including the edge), otherwise it’ll return false.o TIP: The easiest way to figure this out is to compare the lengths of the sum of the radii and the distance between the two center Points. If you don’t know how to calculate a square root, here’s an alternate formula: (p2.Y − p1.Y)2 + (p2.X − p1.X)2 ≤ (radius_A + radius_B)