Question: for the cylinder class, how do you get the radius to work in the formula ublic class Circle f private double radius; public Circle() radius-0.0;

for the cylinder class, how do you get the radius to work in the formula
 for the cylinder class, how do you get the radius to
work in the formula ublic class Circle f private double radius; public
Circle() radius-0.0; public Circle(double aRadius) radius-aRadius; public double getCircumference) double circumference; circumference-2*3.14*radius;

ublic class Circle f private double radius; public Circle() radius-0.0; public Circle(double aRadius) radius-aRadius; public double getCircumference) double circumference; circumference-2*3.14*radius; return circumference; e public double getArea() double area; return area; area 2*3.14xradius; 9e public String toString() return "Circumference: "+getcircumference()+"\t"+"Area: "+getArea(); public class Cylinder extends Circle f private double height; epublic Cylinder() super); height-0.0; e public Cylinder(double aRadius,double aHeight) super (aRadius); height-aHeight epublic double getArea() double area;l area-( (2*3.14*radius*radius)+(2*3.14*radiusheight)); return area; epublic double getVolume() double volume; volume=314*radiusadius*height ; return volume e public String toString() return "Surface Area"+getArea()+"Volume"+getVolume ); Create a class Circle that takes a data field radius. Create a constructor with parameter and implement methods getCircumference, getArea, and toString. The toString method returns a description of the circumference and area of the circle. Create a class Cylinder that extends the Circle class. It has an additional data field, height. Create a constructor with parameters and implement methods getArea, getVolume, and toString. The toString method returns a description of the area and volume of the cylinder. Area of circle = r Circumference of circle 2r Total surface area of cylinder-2m" + 2trh -2times area of circle + circumference of circle times height Total volume = trh Area of circle times height Create a tester. Create a Circle object and a Cylinder object. Print the results of the toString method call on either of the objects you have built

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!