Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

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

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

Transactions On Large Scale Data And Knowledge Centered Systems Xxiv Special Issue On Database And Expert Systems Applications Lncs 9510

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Hendrik Decker ,Lenka Lhotska ,Sebastian Link

1st Edition

366249213X, 978-3662492130

More Books

Students also viewed these Databases questions