4.Design a class named Cylinder to represent a cylinder. Tw194164 Class contains: Two double data fields

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter11: More Object-oriented Programming Concepts
Section: Chapter Questions
Problem 1GZ
icon
Related questions
Question

Solve problem using Java code.

+Output screenshots.

4.Design a class named Cylinder to represent a
cylinder.
MIN
Tw194164 class contains:
double data fields
named radius and height that specify the radius
and height of the cylinder. The default values
arMINYAL 9
for both radius and height.
64
ROBERT
A no-arg constructor that creates a default
cylinder.
A constructor that creates a cylinder with the
specified radius and height.
SOBERTI
A method named getArea() that returns the
area of this cylinder.
Ma
■A
named
getVolume() that returns the
volume of this cylinder.
Write a test program that creates two Cylinder
objects-one with radius 3 and height 10, and
DAINYA
ROU
MINIMAL
the other with radius 3.6 and height 4.7. Display
the radius, height, area, and volume of each
ROBER
Cylin VAES
in this order.
ROBER
Transcribed Image Text:4.Design a class named Cylinder to represent a cylinder. MIN Tw194164 class contains: double data fields named radius and height that specify the radius and height of the cylinder. The default values arMINYAL 9 for both radius and height. 64 ROBERT A no-arg constructor that creates a default cylinder. A constructor that creates a cylinder with the specified radius and height. SOBERTI A method named getArea() that returns the area of this cylinder. Ma ■A named getVolume() that returns the volume of this cylinder. Write a test program that creates two Cylinder objects-one with radius 3 and height 10, and DAINYA ROU MINIMAL the other with radius 3.6 and height 4.7. Display the radius, height, area, and volume of each ROBER Cylin VAES in this order. ROBER
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
User Defined DataType
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT