Create a class named Circle with a field for the radius. Be sure to include the following:

  • a default constructor that sets the radius to 1
  • a method to set the value of the radius
  • a method to return the value of the radius
  • a method to compute and return the circle's diameter
  • a method to compute and return the circle's area

Recall that the diameter of a circle is twice its radius and that the area of a circle is 3.14 times the square of its radius.

After creating this class, write a second class, TestCircle, that has a main() method in it. Have this program create a Circle object with radius 10. It should also create a second Circle object that uses the radius set by the default constructor. Once the objects have been created, write code to display the diameter and area of both circles in an attractive fashion.

Although the output from your program is not required to look this way, it might look something like:

The Circle with radius 10.0 has diameter 20.0 and area 314.0.
The Circle with radius 1.0 has diameter 2.0 and area 3.14.

When you are finished, submit both the and files for grading.

Academic Honesty!
It is not our intention to break the school's academic policy. Projects posted are only used as a reference and should not be submitted as is. We are not held liable for any misuse of the solutions. Please see the frequently asked questions page for further questions and inquiries.
Kindly fill out the form. Please provide a valid email address and we'll get back to you in less than 24 hours. We will be sending an invoice through PayPal upon confirmation. We are a non profit organization however we need an amount to keep this organization running, and to be able to complete our research and development.