Question: 3 4 - 3 6 : This should be submitted as two separate . java files. You will need to create the Circle class in
: This should be submitted as two separate java files. You will need to create the Circle class in the same package as
your class with the main method. Use the code below for your circle class
Create a program using the class definition below for a Circle class. In the main method for the program, create an instance of the class called c with as the radius, and then display the diameter of the circle using the accessor method.
public class Circle
private double radius;
private double diameter;
public Circledouble rad
radius rad;
diameter radius;
public double getDiameter
return diameter;
Using the Circle class above, add an accessor getCircumference that uses the radius to compute and return the circumference. Do not add an attribute for circumference. Add an output statement in main to display the result.
Circumference Math.PI radius
Using the Circle class in # above, add an accessor method getArea that uses the readius to compute and return the area. Do not add an attribute for area.
area Math.PI radius radius
From the main method, create a Circle object with a radius of and display the diameter, circumference, and area as shown below using decimal places.
Output:
Diameter is
Circumference is
Area is
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
