Question: Activity 2: Private and public access control Given is a C++ program that consists of a class name Measurement. The program will ask the user

 Activity 2: Private and public access control Given is a C++program that consists of a class name Measurement. The program will askthe user to key in the measurement's information and display the valuesentered by the user. #include using namespace std; class Measurement{ private: intwidth; int length; int height; public: void setWidth (int w) { width= w; } void setLength(int i) { length = 1; } voidsetHeight (int h) { height = h; } int getWidth (void) {return width; } int getLength (void) { return length; } int getHeight(void) { return height; } int calculateArea() { return width*length; } WA

Activity 2: Private and public access control Given is a C++ program that consists of a class name Measurement. The program will ask the user to key in the measurement's information and display the values entered by the user. #include using namespace std; class Measurement{ private: int width; int length; int height; public: void setWidth (int w) { width = w; } void setLength(int i) { length = 1; } void setHeight (int h) { height = h; } int getWidth (void) { return width; } int getLength (void) { return length; } int getHeight (void) { return height; } int calculateArea() { return width*length; } WA int main() { Measurement shapel; int width length height; cout > width; cin >> length; sin >> height; shapel.setWidth (width); shapel.setLength(length); shapel.setHeight (height); IT cout using namespace std; class Measurement{ protected: int width; int length; int height; public: void setWidth (int w) { width = w; } void set Length (int i) { length = 1; void setHeight (int h) { height = h; } int getWidth (void) { return width; } int getLength (void) { return length; } int getHeight (void) { return height; } }; class Calculate: public Measurement public: int calculateArea 0 return width*length; int main() { Calculate shapel; int width length height; cout > width; cin >> length; sin >> height; shapel.setWidth (width); shapel.setLength(length); shapel.setHeight (height); cout using namespace std; elasa protected int width int length int height: publics Measurement width = 0 length = 0; height = 0 int Measurement (int w, int width = length = height = ne void setWidth (int) width = void setLength (int length = void setHeight (int b) height = int getWidth (void) return width int getLength(void) return length int get Height (void) return height: E int calculateArea() return width * length; w int main() { Measurement shapel; Measurement shape2; Measurement shape 3 (20,20,20); int width, length, height; cout > width; cin >> length; cin >> height; shape1. setWidth (width); shapel.setLength (length); shapel.setHeight (height); cout

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!