Question: Create a New Java Project called YourLastNameInheritance . Write a subclass of the Circle class that was developed during the Week 3 Module Circle Class

Create a New Java Project called YourLastNameInheritance.

Write a subclass of the Circle class that was developed during the Week 3 Module Circle Class Project. This subclass encapsulates a cylinder. A cylinder has a circle as its base, and another attribute, its length; it has two methods, calculating and returning its area and volume. You also need to include a client class to test these two classes.

Week 3 Circle Class Project:

Create a New Java Project called YourLastNameCircleClass.

Write a Circle class that has the following fields:

radius: a double

PI: a final double initialized with the value 3.14159

NOTE: The Circle Class is a new class within your project. This does not affect the name of your Java Project above.

The class should have the following methods:

Constructor: accepts the radius of the circle as an argument.

Constructor: a no-arg constructor that sets the radius field to 0.0.

setRadius: a mutator method for the radius field.

getRadius: an accessor method for the radius field.

getArea: returns the area of the circle, which is calculated as area = PI * radius * radius.

getDiameter: returns the diameter of the circle, which is calculated as diameter = radius * 2.

getCircumference: returns the circumference of the circle, which is calculated as circumference = 2 * PI * radius.

Write a program 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.

Please include program comments so I can follow through.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!