Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write a C++ code for the following Please complete the exercises assigned below. This lab assignment will continue with the design of a class

Please write a C++ code for the following image text in transcribed
Please complete the exercises assigned below. This lab assignment will continue with the design of a class which you created in Lab 2, and focus on inheritance, as well as using a collection of objects (array or other)t. You can modify your Lab 2 project/class or create a new class with the inheritance hierarchy shown below. Consider the class you created in Lab \#2, and create an Inheritance Hierarchy (Is-A Relationship) with at least 6 classes total and with 3 levels of inheritance (App class, Base Class, 3 Derived classes, 1 Composition class). 1. Include at least two additional member variables/instance variables (select the appropriate data types) for each derived class. Use any type you like. 2. Create appropriate constructor methods in each derived class, including a default constructor ( 0 argument) and the all-argument constructor. 3. Create necessary accessor and mutator methods (these are the get methods) - one for each member variable. 4. Override a base class method (showValues, for example) in each of the derived classes so that the values will be displayed of the object with the additional member variables. 5. Add another class showing composition relationship (Has-A) in which you include an object of this type in another class. For example, Car has-a Tire, Computer has-a HardDrive, Employee has-a Address, House has-a Room, etc. Output Requirements: (Exercise all methods, including constructors to show their results/output) In main(), create at least 2 objects from each class ( 8 total objects), and add the values either during instantiation (with the all-argument constructor), and/or later with the mutator methods, and show the fully populated object values using the showValues() overriding method in each class object Please complete the exercises assigned below. This lab assignment will continue with the design of a class which you created in Lab 2, and focus on inheritance, as well as using a collection of objects (array or other)t. You can modify your Lab 2 project/class or create a new class with the inheritance hierarchy shown below. Consider the class you created in Lab \#2, and create an Inheritance Hierarchy (Is-A Relationship) with at least 6 classes total and with 3 levels of inheritance (App class, Base Class, 3 Derived classes, 1 Composition class). 1. Include at least two additional member variables/instance variables (select the appropriate data types) for each derived class. Use any type you like. 2. Create appropriate constructor methods in each derived class, including a default constructor ( 0 argument) and the all-argument constructor. 3. Create necessary accessor and mutator methods (these are the get methods) - one for each member variable. 4. Override a base class method (showValues, for example) in each of the derived classes so that the values will be displayed of the object with the additional member variables. 5. Add another class showing composition relationship (Has-A) in which you include an object of this type in another class. For example, Car has-a Tire, Computer has-a HardDrive, Employee has-a Address, House has-a Room, etc. Output Requirements: (Exercise all methods, including constructors to show their results/output) In main(), create at least 2 objects from each class ( 8 total objects), and add the values either during instantiation (with the all-argument constructor), and/or later with the mutator methods, and show the fully populated object values using the showValues() overriding method in each class object

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

Public Finance Fundamentals

Authors: K. Moeti

3rd Edition

148512946X, 9781485129462

Students also viewed these Databases questions