Consider the following declarations: class houseType { public: void set(string,
ID: 3767065 • Letter: C
Question
Consider the following declarations:
class houseType
{
public:
void set(string, int, int, int, int, int, double, double);
void print() const;
void setStyle(string);
string getSyle() const;
void setNumOfBedrooms(int);
int getNumOfBedrooms() const;
void setNumOfBedrooms(int);
int getNumOfBathrooms() const;
void setNumOfCarsGarage(int);
int getNumOfCarsGarage() const;
void setYearBuilt(int);
int getYearBuilt() const;
void setFinishedSquareFootage(int);
int getFinishedSquareFootage() const;
void setPrice(double);
double getPrice() const;
void setTax(double);
double getTax() const;
houseType(string = "", int = 0, int = 0, int = 0, int = 0, int = 0, double = 0, double = 0);
private:
string style;
int numOfBedrooms;
int numOfBathrooms;
int numOfCarsGarages;
int yearBuilt;
int finishedSquareFootage;
double price;
double tax;
};
houseType newHouse; //variable declaration
a. How many members does class houseType have?
b. How many private members does class houseType have?
c. How many constructors does class houseType have?
d. How many constant functions does class houseType have?
anser please, also please make sure it is right, thankyou!
Explanation / Answer
======================================================
a. How many members does class houseType have?
-----------
Answer:
-----------
class houseType have 8 members.
-----------
Explanation:
-----------
As per the defination all the variables of a class calledas members.
--------------------------------------------
The following are the members of the class
--------------------------------------------
string style;
int numOfBedrooms;
int numOfBathrooms;
int numOfCarsGarages;
int yearBuilt;
int finishedSquareFootage;
double price;
double tax;
=======================================================
b. How many private members does class houseType have?
-----------
Answer:
-----------
class houseType have 8 private members.
-----------
Explanation:
-----------
As per the defination all the variables of a class called with private access specifier as members.
--------------------------------------------
The following are the private members of the class
--------------------------------------------
string style;
int numOfBedrooms;
int numOfBathrooms;
int numOfCarsGarages;
int yearBuilt;
int finishedSquareFootage;
double price;
double tax;
=======================================================
c. How many constructors does class houseType have?
-----------
Answer:
-----------
class houseType have 1 constructor.
-----------
Explanation:
-----------
As per the cosntructor defination, construtor must match with the class name.
houseType(string = "", int = 0, int = 0, int = 0, int = 0, int = 0, double = 0, double = 0);
=======================================================
d. How many constant functions does class houseType have?
-----------
Answer:
-----------
class houseType have 9 constant functions.
-----------
Explanation:
-----------
As per the constant function defincation, A function with const keyword treated as constat function.
--------------------------------------------
The following are the constant functions of the class
--------------------------------------------
void print() const;
string getSyle() const;
int getNumOfBedrooms() const;
int getNumOfBathrooms() const;
int getNumOfCarsGarage() const;
int getYearBuilt() const;
int getFinishedSquareFootage() const;
double getPrice() const;
double getTax() const;
=======================================================