Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

a.Design a class named Circle with fields named radius, area and diameter. Inclu

ID: 3645682 • Letter: A

Question

a.Design a class named Circle with fields named radius, area and diameter. Include a constructor that sets the radius to 1. Include get methods for each field, but include a set method only for radius. When the Radius is set do notallow it to be zero or a negative number When the radius is set , calculate the diameter(Twice the radius) and the area (the radius squared times pi which is approximatley3.14) Creatte the class diagram and write the psuedocode tht defines the class.

B) design an application that declares two circles . Set the radius of one manually, but allow the other to use the default value supplied by the constructor. Then display each circles values.

Explanation / Answer

A) class Circle { private double radius, area, diameter; public Circle() { radius = 1; } public void setRadius(double r) { radius = r; if (radius