# LAB circle and Circle Driver

Create a java class Circle as described below:

radius: a double

PI: a final double initialized with the value 3.14159

The class should have the following methods:

calculateArea - Returns the area of the circle, which is calculated as:

area = PI * radius * radius

calculateDiameter - Returns the diameter of the circle, which is calculated as:

diameter = radius * 2

calculateCircumference - Returns the circumference of the circle, which is calculated as:

circumference = 2 * PI * radius

setRadius - A mutator (setter) method for the radius field

getRadius - An accessor (getter) method for the radius field

Create test data and calculate the expected result.

Input Expected Results

Radius Area Diameter Circumference

- - - -

- - - -

- - - -

Write a program name CircleDriver that demonstrates the Circle class by asking the user for the circle's radius, creating a Circle object, and then reporting the circle's area, diameter, and circumference.

radius: a double

PI: a final double initialized with the value 3.14159

The class should have the following methods:

calculateArea - Returns the area of the circle, which is calculated as:

area = PI * radius * radius

calculateDiameter - Returns the diameter of the circle, which is calculated as:

diameter = radius * 2

calculateCircumference - Returns the circumference of the circle, which is calculated as:

circumference = 2 * PI * radius

setRadius - A mutator (setter) method for the radius field

getRadius - An accessor (getter) method for the radius field

Create test data and calculate the expected result.

Input Expected Results

Radius Area Diameter Circumference

- - - -

- - - -

- - - -

Write a program name CircleDriver that demonstrates the Circle class by asking the user for the circle's radius, creating a Circle object, and then reporting the circle's area, diameter, and circumference.

You'll get 1 file (4.0KB)