Now, add a few methods to your Circle2D class to extend its functionality. Starting with your solution to the previous task (

Now, add a few methods to your Circle2D class to extend its functionality. Starting with your solution to the previous task (or re-typing it all if you are keen!), now add the methods below: • A method named getArea() that returns the area of the circle. • A method named getPerimeter() that returns the perimeter of the circle. • An overridden equals method that compares whether two circles are equal based on their radius. Write the Circle2D class in the answer box below. Note – keep a copy of your solution to this task because you will be extending it step by step in subsequent tasks. For example: Test Result 31.42 Circle2D c1 = new Circle2D(5.0); System.out.printf(“%.2fn”, c1.getPerimeter()); 78.54 Circle2D c1 = new Circle2D(5.0); System.out.printf(“%.2fn”, c1.getArea());



Source link

Leave a Reply

Your email address will not be published. Required fields are marked *