Here is the link for part 1 post: http://www.chegg.com/homework-help/questions-a
ID: 3648847 • Letter: H
Question
Here is the link for part 1 post:http://www.chegg.com/homework-help/questions-and-answers/5-parts-program-i-posting-separate-chance-earn-points-respond-post-garbage-code-thank-1-mo-q2848766
Here is the link for part 2 post:
http://www.chegg.com/homework-help/questions-and-answers/link-1-post-http-wwwcheggcom-homework-help-questions-answers-5-parts-program-i-posting-sep-q2848776
Part 3: Circle class
Write a new Circle class that has the functionality of the textbook's class, but that extends the Ellipse class rather than directly extending the GeometricObject class. If you do this right, you should be able to use the Ellipse class's area() method to correctly calculate the area of a circle. The perimeter of a circle is given exactly by 2*pie*r, where r is the radius of a circle. So you'll need to write a perimeter method.
Explanation / Answer
Assuming I properly interpreted what the book wanted for this class, the following should be acceptable: public class Circle extends Ellipse { private double r;//radius /**Cicrle constructor, takes as input a radius**/ public Circle(double r) { super(r,r);//creates an ellipse with major and minor axis as 2r this.r = r; } /**set radius**/ public void setRadius(double newR) { r = newR; } /**get radius**/ public double getRadius() { return r; } /**get perimeter of circle**/ public double getPerimiter() { return(Math.PI*2.0*r);// } }