Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following question is referring to the CH source code in Figure Q2(b). #include using namespace std; class Box 1 private: float length: float height;

image text in transcribedimage text in transcribed

The following question is referring to the CH source code in Figure Q2(b). #include using namespace std; class Box 1 private: float length: float height; float width; public: Box(); void setValues (float, float, float); float getVolume 0); }; void Box:: setValues (float 1, float h, float w) length - 1; height = h; width = w; float Box::getVolume () return (length-height*width); 1 int main() + Box cubic; return 0; Figure Q2(b) (1) Write a function definition for constructor to initialize all private member variables to 0.0. [5 marks] (ii) in main function, construct a CH code to call setValues() member function and set the private member variables as following, length - 2.4 height - 68 width - 10.12 [4 marks) (iii) In main function, write a C++ code to display the volume of cubic object by calling the getVolume() member function. Your output console should display as per Figure Q2(b)(). Volume is : 165.158 process returned (exe) execution time : 0.070 s Press any key to continue. Figure Q2(b)(ii) [3 marks)

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

Practical Azure SQL Database For Modern Developers Building Applications In The Microsoft Cloud

Authors: Davide Mauri, Silvano Coriani, Anna Hoffma, Sanjay Mishra, Jovan Popovic

1st Edition

1484263693, 978-1484263693

More Books

Students also viewed these Databases questions

Question

=+ Are there closed-shop requirements or practices?

Answered: 1 week ago