Question: Write a Cylinder class to get the desired output as shown below. 1. You will have to create a Cylinder class. 2. You will

Write a Cylinder class to get the desired output as shown below.

Write a Cylinder class to get the desired output as shown below. 1. You will have to create a Cylinder class. 2. You will have to create 2 class variables. 3. Create a required constructor. 4. Write 2 class methods: One that takes the height first and then the radius and then swaps One that takes a string where the radius and height values are separated with a hyphen. 2 static methods: Write One that calculates the area of a whole cylinder (formula: 2r + 2rh) Another that calculates the volume of a cylinder (formula: Trh) **Observe the output values carefully to understand how the radius and height values are changing.

Step by Step Solution

3.34 Rating (151 Votes )

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 Programming Questions!