Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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
image text in transcribed
image text in transcribed
image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Semantics In Databases Second International Workshop Dagstuhl Castle Germany January 2001 Revised Papers Lncs 2582

Authors: Leopoldo Bertossi ,Gyula O.H. Katona ,Klaus-Dieter Schewe ,Bernhard Thalheim

2003rd Edition

3540009574, 978-3540009573

More Books

Students also viewed these Databases questions

Question

Who is able to issue commercial paper and for what purpose?

Answered: 1 week ago