Question
Design and implement a class that will simulate a cylinder; call the class Cylinder. Name your instance variables radius and height. Have functions called calculateSurfaceArea
Design and implement a class that will simulate a cylinder; call the class Cylinder. Name your instance variables radius and height. Have functions called calculateSurfaceArea and calculateVolume. Implement Accessors and Mutators for all instance variables of the class. Have two constructors; the first will be the default constructor (set all instance variables to 1) and the second will be a constructor that will pass values to set the instance variables to the object. Develop a function printCylinderInfo which will print a four line description of the cylinder. It will output a neat formatted string showing the radius and height of the object as well as the objects surface area and volume. Use two decimal points of accuracy with the printCylinderInfo method. You may hard code the data for three Cylinders (you'll need radius and height for each). Create a Cylinder object for each, and use the functions of the Cylinder class to print out the height, radius, volume, and surface area of each cylinder. Use the data in the image.
myCylinder01 7.3 3.1 myCylinder02 myCylinder03 2 4 radius heightStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started