Question
Please use java in apache netbeans. In this lab, you are going to create a Circle class. This will have two data members: radius: Of
Please use java in apache netbeans. In this lab, you are going to create a Circle class. This will have two data members:
radius: Of double datatype
PI: Constant initialized with 3.14159
This class should have the following methods:
Default Constructor: It is no argument constructor which sets radius filed to 0.0
Constructor: Accepts radius of the circle as an argument.
setRadius: A mutator method for the radius field.
getRadius: An accessor method for the radius field.
calculateArea: Returns the area of the circle which is equal to (PI*radius*radius)
calculateDiameter: Returns the diameter of the circle which is equal to (2*radius)
calculateCircumference: Returns the circumference of the circle which is equal to (2*PI*radius)
Write a program which demonstrate the working of this class by creating 5 objects and then reporting the area, diameter, and the circumference of each of those 5 objects.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started