Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem 1: Create a class called Cylinder which contains the following: Three private instance variables of type double: Radius, Height, and Volume The following public
Problem 1: Create a class called Cylinder which contains the following: Three private instance variables of type double: Radius, Height, and Volume The following public functions: A default constructor with no argument that initialize the attributes in to default values 0.1, 0.1 for Radius, Height, and calculate the value of the initial volume. A constructor which takes one double argument for Radius and assume the value of Height =0.2 and calculates the value of the volume based on those values. A constructor which takes two double arguments for Radius and Height and calculates the value of the volume based on those values. Set function for radius and height attributes. Get function for radius and height attributes. Calculate volume: this function takes no argument and calculates the volume of the cylinder (v = 3.14.ph) GetVolume: returns the value of the volume. PrintInfo: print the information of the cylinder. NOTE: make sure any parameter passed to the functions has a positive value. Write a menu Driven program to test your class functions, with the following options: 1) Enter the Cylinder Radius and Height. 2) Print Cylinder info 3) Calculate & print volume 4) Exit
Step 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