Answered step by step
Verified Expert Solution
Question
1 Approved Answer
(b) The following question is referring to the C++ source code in Figure 02(b). #include using namespace std; class Box private: float length float height:
(b) The following question is referring to the C++ source code in Figure 02(b). #include using namespace std; class Box private: float length float height: float width: public Box(); void setValues (float, float, float): float getVolune 0); void Box::SetValues (float 1, float n, float w) 1 length - 1; height-h width-w; 1 float Box::getVolume 1 return (length height-width: 1 int main() Box cubic; return 0; Figure 02(b) (1) Write a function definition for constructor to initialize all private member variables to 0.0 [5 marks] in In main function, construct a C++ code to call setValues() member function and set the private member variables as following length - 2.4 height - 6.8 width - 10.12 (4 marks] (i) 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)(iii) Volume is : 165.158 process returned @ (exe) Press any key to continue. execution time: 0.670 s Figure Q2(b)(im) [3 marks] Johnny wants to process data inventory by using an array. The operations needed in this system are deleting items, adding new items, and sorting data based on the item code. However, his group member, Marzuki does not agree because using an array is not efficient. () Justify that Marzuki's argument is true. [3 marks] Give a suggestion of the data structure that is suitable for handling this case. [3 marks]
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