Design a class named Cylinder to represent cylinders. The class contains: ➤Two private double data fields named radius and length that specify the radius an of a cylinder. The default values are 1.0 for radius and length. ➤ An int static data field named number OfObjects. The default value is 0. ➤ A no-arg constructor that creates a default cylinder. ➤ A constructor that creates a cylinder with the specified radius and length.
Design a class named Cylinder to represent cylinders. The class contains: ➤Two private double data fields named radius and length that specify the radius an of a cylinder. The default values are 1.0 for radius and length. ➤ An int static data field named number OfObjects. The default value is 0. ➤ A no-arg constructor that creates a default cylinder. ➤ A constructor that creates a cylinder with the specified radius and length.
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
100%
Need help writing the program. Please provide with ss of ur work if possible.
Expected display result when running the program is attatched with the image.

Transcribed Image Text:The base area of the second cylinder
The radius of the first cylinder is: 1.0 and the length is: 1.0
is: 19.634954084936208
The volume of the third cylinder is: 510.5088062083414
The amount of objects created is: 3

Transcribed Image Text:Design a class named Cylinder to represent cylinders. The class contains:
Two private double data fields named radius and length that specify the radius and length
of a cylinder. The default values are 1.0 for radius and length.
➤ An int static data field named numberOfObjects. The default value is 0.
➤ A no-arg constructor that creates a default cylinder.
➤ A constructor that creates a cylinder with the specified radius and length.
➤ Two sets of get and set methods for the two private data fields.
➤ A method named getArea() that returns the base area of the cylinder.
➤ A method named getVolume() that returns the volume of the cylinder.
➤ The static getNumberOfObjects method to return the data field numberOfObjects.
Requirements:
1. Draw the UML diagram for the class. Implement this class. The data fields should be
private, and constructors and all other methods should be public.
2. Write a test program that should do the following tasks:
➤ create the first cylinder object using the no-arg constructor;
create a second cylinder using the constructor with arguments to set radius to 2.5 and
length to 12.3;
➤
create a third cylinder using the no-arg constructor;
➤ change the third cylinder’s radius to 5.0 and length to 6.5.
➤
print out the radius and length of the first cylinder;
print out the area of the second cylinder;
print out the volume of the third cylinder.
print out the value of the numOfObjects data field;
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 3 images

Follow-up Questions
Read through expert solutions to related follow-up questions below.
Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY