Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

. . . X P2 - The Cube class (20 points) Define the class RectangularCube. A RectangularCube has three sides length(L), width (W), and Height

image text in transcribed
. . . X P2 - The Cube class (20 points) Define the class RectangularCube. A RectangularCube has three sides length(L), width (W), and Height (h), define the sides as private data fields [1pts]. Include a no-argument constructor that sets all three sides to 1 [1pts]. The class must also have a constructor with parameters that receive parameters to initialize sides of the RectangularCube [2pts]. Include get and set functions for all three data fields [1pts]. Finally define the functions volume () and surfaceArea () in the class RectangularCube that use the formulas given below to calculate and return the volume and the surface area of the RectangularCube [2pts]. Rectangular Solid Volume = Length X Width X Height h V = lwh Surface = 2/w + 2/h + 2wh a) Give the UML diagram of the class, you may use the MSOffice/Visio to create the UML class diagram (best to download and use Visual paradigm tool) [2pts]. b) Implement the class using separate files for definition and implementation, use inclusion guard to avoid duplicate code. Make sure to include at least one inline function implementation. Do not Implement the volume () and the SurfaceArea () as inline functions. Include comments in your code [3pts]. c) Write a test function for the class RectangularCube and perform the following tasks: a. Create two objects, one object using the no-argument constructor and another using the constructor with parameters (pick any values for the L, W, and H) [1pts]. b. Invoke the volume () and SurfaceArea () functions on both object and display their returned value [1pts]. c. Invoke a set functions on an object and change the value of one of the sides [1pts]. d. Invoke the volume () and surfaceArea () on the object in part (c) and print the returned values [1pts] e. Assign (using the operator =) and anonymous RectanularCube object to the object in part (c). Once again invoke the volume () and surfaceArea () functions on the object in part (c) [1pts]. d) Code submission and proper run results [3pts]. Your C++ code for this problem Copy and paste your code here Type here to search 2:45 PM 199+ a w 70'F ~ D 4 ( ()) 7/7/2021

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

Introduction to Wireless and Mobile Systems

Authors: Dharma P. Agrawal, Qing An Zeng

4th edition

1305087135, 978-1305087132, 9781305259621, 1305259629, 9781305537910 , 978-130508713

More Books

Students also viewed these Programming questions