subject

Btw: this is not a middle school question, it is college.

assume the existence of a building class. define a derived class, apartmentbuilding that contains four (4) data members: an integer named numfloors, an integer named unitsperfloor, a boolean named haselevator, and a boolean named hascentralair. there is a constructor containing parameters for the initialization of the above variables (in the same order as they appear above). there are also two functions: the first, gettotalunits, accepts no parameters and returns the total number of units in the building; the second, isluxurybuilding accepts no parameters and returns true if the building has central air, an elevator and 2 or less units per floor.

the solution i have tried is:
class apartmentbuilding: public building
{
private:
int numfloors;
int unitsperfloor;
bool haselevator;
bool hascentralair;
public:
apartmentbuilding(int x, int y, bool b, bool c){
numfloors=x;
unitsperfloor=y;
haselevator=b;
hascentralair=c;
};
int gettotalunits();
bool isluxurybuilding();
};

int apartmentbuilding: : gettotalunits(){
return numfloors*unitsperfloor;
}
bool apartmentbuilding: : isluxurybuilding(){
if(hascentralair==true & & haselevator == true & & unitsperfloor< =2)
return true;
else
return false;
}

this, however, does not work! i get an error stating: "in file included from ctest. cpp: 32: 0:
c. h: 1: 108: error: declaration of ā€˜apartmentbuilding: : apartmentbuilding(int, int, bool, bool)ā€™ outside of class is not definition [-fpermissive]
apartmentbuilding: : apartmentbuilding(int numfloors, int unitsperfloor, bool haselevator, bool hascentralair); "

i don't understand question is from myprogramminglab.

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 24.06.2019 06:30
Me and category do i put them in because this is science
Answers: 1
question
Computers and Technology, 25.06.2019 04:10
While creating a web page, what does each of the following html tags define? 1. 2. 3. 4. a. defines a new paragraph b. defines a term c. defines a single line break d. defines a heading
Answers: 1
question
Computers and Technology, 25.06.2019 07:00
The graph shows the number of chapters sarah read in a book each day of a week
Answers: 1
question
Computers and Technology, 25.06.2019 09:20
Part d: float check string has a method s.isdigit() that returns true if string s contains only digits and false otherwise, i.e. s is a string that represents an integer. write a function named float_check that takes one parameter that is a string and returns true if the string represents a float and false otherwise. for the purpose of this function we define a float to be a string of digits that has at most one decimal point. note that under this definition an integer argument will return true. remember ā€œedge casesā€ such as ā€œ45.ā€ or ā€œ.45ā€; both should return true. for example: float_check('1234') returns true float_check('123.45') returns true float_check('123.45.67') returns false float_check('34e46') returns false float_check('.45') returns true float_check('45.') returns true float_check('45..') returns false
Answers: 2
You know the right answer?
Btw: this is not a middle school question, it is college.

assume the existence of a buil...
Questions
question
Geography, 17.10.2019 22:00