Question: Exercise 4a-b: Add a method to Circle.java that returns true if this Circle object touches another Circle object externally, and false otherwise. Add a method
Exercise 4a-b: Add a method to Circle.java that returns true if this Circle object touches another Circle object externally, and false otherwise. Add a method to Circle.java that returns true if this Circle object touches another Circle object internally, and false otherwise.
*I am using JGrasp so please make sure it is compatible *FULL QUESTION IN IMAGES BELOW


Exercise 4: We discussed the following example ofobject interactions in the lectures. We define a Point class and a Circle class. The Circle class has a method that checks if a Point object is enclosed inside the Circle object. Study the code, run it and understand it. //Point class Defines a point with coordinates px and py public class Point private double px; private double py; //constructor public Point (double px, double py) this .px px; this py py; //get and set methods public void setX (double px) this px px public void setY (double py) (this .py py; public double getX {return px; public double gety return py; to string method pu. ring EOS ring O Cit cle class "radius py tai public class Circle instance variables private double cx private double cy; private double radius; //constructor public Circle (double cx, double cy, double radius) this Cx CX this .cy cy; this radius radius //get and set methods public void setcx (double cx) (this CX public void setCY double cy) (this cy cy; public void setRadius (double radius) this radius radius public double getcx() {return cx; public double getCY {return cy; public double getRadius fre turn. radius
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
