Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

CSNB244 Programming II (2021) Lab 5 - Class Student ID: Student Name: Instruction: Answer all questions. Write your answer to the table located on the

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 transcribedimage text in transcribedimage text in transcribedimage text in transcribed

CSNB244 Programming II (2021) Lab 5 - Class Student ID: Student Name: Instruction: Answer all questions. Write your answer to the table located on the final page of this document. Do not remove any pages. Activity 1: Base Class Given is a C++ program that consists of a class name Book. The value is pre-defined by the programmer #include using namespace std; class Book public: int id; string title; string author; int year; float price; }; int main() { Book bookl; booki.id = 1; booki.title = "Learn C++ Programming"; booki.author = "Chand Miyan"; booki.year = 2015; book1.price = 99.9; cout using namespace std; class Book public: int id; string title; string author; int year; float price; }; int main() { Book booki, book2; booki.id = 1; booki.title = "Learn C++ Programming"; bookl. author = "Chand Miyan"; bookl.year = 2015; book1.price - 99.9; book2.id = 2; book2.title - 'Computer Organization and Architecture book2.author = "William Stallings"; book2.year = 2019; book2.price = 79.9; cout 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; } }; int main() { 3 (2021) CSNB244 Programming II Lab 5 - Class Student ID Student Name: Measurement shapel; int width, length, height; cout > width; cin >> length; cin >> height; shapel.setWidth(width); shapel.setLength (length); shapel.setHeight (height); cout > width; cin >> length; cin >> height; shapel.setWidth(width); shapel.setLength(length); shapel.setHeight (height); cout using namespace std; class Measurement { protected: int width; int length; int height; public: void setWidth (int w) { width = w; } void setLength(int i) { length = 1; 4 (2021) CSNB244 Programming II Lab 5 - Class Student ID Student Name: 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() { return width*length; int main() { Calculate shapel; int width, length, height; cout > width; cin >> length; cin >> height; shapel.setWidth(width); shanel setLength llenathi. width = w; ) void setLength(int i) { length = 1; 4 (2021) CSNB244 Programming II Lab 5 - Class Student ID: Student Name: void setHeight (int h) { height = h; 1 int getWidth (void) { return width; } int getLength(void) { return length; } int getHeight (void) { return height; } }; class Calculate: public Measurement public: int calculateArea() { return width+length; int main() { Calculate shapel; int width, length, height; cout > width; cin >> length; cin >> height; shapel.setWidth (width); shapel.setLength(length); shapel.setHeight (height); cout using namespace std; class protected: int width: int length: int height; public: Measurement () width = 0; length = 0; height = 0; int int Measurement (int width = length = 12 (2021) CSNB244 Programming II Lab 5-Class Student ID: Student Name: height = void setWidth (int width = void setLength (int length = void setHeight (int) height = int getWidth (void) return width: int getLength (void) return length: int getHeight (void) return height; int calculateArea() return width + length; int main() { Measurement shapel; Measurement shape2; Measurement shape 3 (20,20, 20); int width, length, height; cout > width; 12 (2021) CSNB244 Programming II Lab 5 - Class Student ID Student Name: height = void setWidth (int width = void setLength (int length = 1 void setHeight (int height = 1; int getWidth (void) return width: int getLength (void) return length: int getHeight (void) return height: int calculateArea() return width + length; int main() { Measurement shapel; Measurement shape2; Measurement shape 3 (20,20,20); int width, length, height; cout > width; cin >> length; cin >> height; shapel.setWidth(width); shapel.setLength (length); shapel.setHeight (height); cout > width; cin >> length; cin >> height; shapel.setWidth(width); shapel.setLength(length); shapel.setHeight (height); cout using namespace std; class Book public: int id; string title; string author; int year; float price; }; int main() { Book bookl; booki.id = 1; booki.title = "Learn C++ Programming"; booki.author = "Chand Miyan"; booki.year = 2015; book1.price = 99.9; cout using namespace std; class Book public: int id; string title; string author; int year; float price; }; int main() { Book booki, book2; booki.id = 1; booki.title = "Learn C++ Programming"; bookl. author = "Chand Miyan"; bookl.year = 2015; book1.price - 99.9; book2.id = 2; book2.title - 'Computer Organization and Architecture book2.author = "William Stallings"; book2.year = 2019; book2.price = 79.9; cout 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; } }; int main() { 3 (2021) CSNB244 Programming II Lab 5 - Class Student ID Student Name: Measurement shapel; int width, length, height; cout > width; cin >> length; cin >> height; shapel.setWidth(width); shapel.setLength (length); shapel.setHeight (height); cout > width; cin >> length; cin >> height; shapel.setWidth(width); shapel.setLength(length); shapel.setHeight (height); cout using namespace std; class Measurement { protected: int width; int length; int height; public: void setWidth (int w) { width = w; } void setLength(int i) { length = 1; 4 (2021) CSNB244 Programming II Lab 5 - Class Student ID Student Name: 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() { return width*length; int main() { Calculate shapel; int width, length, height; cout > width; cin >> length; cin >> height; shapel.setWidth(width); shanel setLength llenathi. width = w; ) void setLength(int i) { length = 1; 4 (2021) CSNB244 Programming II Lab 5 - Class Student ID: Student Name: void setHeight (int h) { height = h; 1 int getWidth (void) { return width; } int getLength(void) { return length; } int getHeight (void) { return height; } }; class Calculate: public Measurement public: int calculateArea() { return width+length; int main() { Calculate shapel; int width, length, height; cout > width; cin >> length; cin >> height; shapel.setWidth (width); shapel.setLength(length); shapel.setHeight (height); cout using namespace std; class protected: int width: int length: int height; public: Measurement () width = 0; length = 0; height = 0; int int Measurement (int width = length = 12 (2021) CSNB244 Programming II Lab 5-Class Student ID: Student Name: height = void setWidth (int width = void setLength (int length = void setHeight (int) height = int getWidth (void) return width: int getLength (void) return length: int getHeight (void) return height; int calculateArea() return width + length; int main() { Measurement shapel; Measurement shape2; Measurement shape 3 (20,20, 20); int width, length, height; cout > width; 12 (2021) CSNB244 Programming II Lab 5 - Class Student ID Student Name: height = void setWidth (int width = void setLength (int length = 1 void setHeight (int height = 1; int getWidth (void) return width: int getLength (void) return length: int getHeight (void) return height: int calculateArea() return width + length; int main() { Measurement shapel; Measurement shape2; Measurement shape 3 (20,20,20); int width, length, height; cout > width; cin >> length; cin >> height; shapel.setWidth(width); shapel.setLength (length); shapel.setHeight (height); cout > width; cin >> length; cin >> height; shapel.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

Advances In Spatial And Temporal Databases 11th International Symposium Sstd 2009 Aalborg Denmark July 8 10 2009 Proceedings Lncs 5644

Authors: Nikos Mamoulis ,Thomas Seidl ,Kristian Torp ,Ira Assent

2009th Edition

3642029817, 978-3642029813

More Books

Students also viewed these Databases questions

Question

6. How do histories influence the process of identity formation?

Answered: 1 week ago