Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Security XI Status And Prospects

Authors: T.Y. Lin, Shelly Qian

1st Edition

0412820900, 978-0412820908

More Books

Students also viewed these Databases questions

Question

4. What sales experience have you had?

Answered: 1 week ago

Question

15-5 How will MIS help my career?

Answered: 1 week ago