Question
Using Java create a Circle class that has: 1 double variable for radius A static variable PI which equals 3.14159 Gets and Sets statements for
Using Java
create a Circle class that has:
1 double variable for radius A static variable PI which equals 3.14159 Gets and Sets statements for the radius variable. A getArea() method that returns the Area of the Circle (formula is a = (PI * r^2), (use the Math.pow() method pg 62 in book). A getDiameter() method that returns the diameter of the circle (d=2r) A getCircumference() method that returns the circumference of the circle. Create a constructor for the Circle class that takes 1 argument. Create a No-Arg constructor for the Circle class. After creating the Circle Class, add a main method at the bottom that requests a number for input and returns information on the circle. Example Input and Output Please enter the radius of the circle 5.6 A circle with a radius of 5.60 will have an area of 98.52, a diameter of 11.20 and a circumference of 35.19.
The code:
import java.util.*; /* * Created: * Author: Olivia Nwanne * FileName: Circle.java */
public class Circle {
// enter code here
} // end Circle class"
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