Question
Define a House class which has the following 1- int hno (House number), int roomNo (number of Rooms in the house), 2-char *StreetName (Street Name),
Define a House class which has the following
1- int hno (House number), int roomNo (number of Rooms in the house),
2-char *StreetName (Street Name), char *City;
3-Room *r (pointer to array of Room Objects defined in the heap). The size of array of room objects is roomNo. Room Class has double area, and char color[10].
4-Door arr[4] which is an array of objects of Door class. Door class has double size and char color[10].
do the following:
A)Define all necessary Constructors + Destructors + functions. Inside constructors, Do all possible initializations for data members (3 points).
B)Define House h1 object with 3 rooms, h2 with 4 rooms and h3 with 3 rooms. Do all necessary initializations for its data members inside a constructor. (3 points)
C)Do what is required to know the number of active objects of class house using static data member and function. Use this inside main function (3 points)
D)Define a function that prints the colors of the doors in h1. (3 points)
E) define a function that prints the total area of house h2.(3 points)
F)Define a function that prints the number of similar door colors in both houses h1 and h3. (3 points)
G) using setColor function member in class Door, change all doors colors in h3 to Yellow. (2 points)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started