Question: P3 - An Array of objects (15 points) In this problem we will continue to expand on problem 2. a. Write the function with the

P3 - An Array of objects (15 points) In this problem we will continue to expand on problem 2. a. Write the function with the header void printCube (RectangularCube rc) that receives an object of the type RectangularCube and displays the length, width, height, volume and the surface area of the cube like: L = 2, W = 1, H = 1, V =2, A = 8. This function should be implemented as a non-member function, meaning that it should be defined outside the class RectangularCube [3pts]. b. Write a main function in which you declare an array of 5 RectangularCube objects [2pts]. Inside the main function, use a loop to initialize/populate this array of RectangularCube. In the body of the loop use the rand () function to generate random integers between 1 and 10 to assign to length, width and height data fields of each RectangularCube object [5pts]. c. After populating the array, use another loop to display individual elements of the array in part (a) by calling the function printCube in part (a) [3pts]. d. Code submission and sample output [2pts]
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
