Define a class building
that has the following interface:
//Default Constructor
//Creates new building with all rooms empty
building( );
//Constructor
//Creates a new building with one person with name s[ ] and ID number N[
],
//into room 0 on floor 0.
building(const char s[ ], const char N[ ], );
//Puts person with name
s[ ] and ID number N [ ] into
//room on floor f and room number n. If f and n are out of range it
prints an error message.
void Put(char s[ ], char N[ ], int f, int n);
//Defines room on floor f and number n to be empty
void Empty(int f, int n);
//Prints name/ID No. of occupant of room on floor f and number n
//If room is empty prints message "Room n on floor f is empty"
//where n,f are replaced by the appropriate values. If f and n are out of
range it prints an error message.
void Display(int f, int n);
//Prints, in alphabetical order, one person per line, the
//name/ID No of all occupants of floor f in the form <name><tab><id>.
//If floor is empty it prints the message "Floor f is empty"
//where f is replaced by the appropriate values. If f is out of
range it prints an error message
void Display(int f);
//Prints, in alphabetical order,
// name/ID Nos of all occupants of building
//If building is empty prints message
//"Building is empty"
void Display( );
//returns the number of empty rooms on floor f. If f is out of range it
prints an error message.
int Vacancies(int f);
//returns the number of empty rooms in the building
int Vacancies( );
//Overloads the << operator for buildings, such that it
prints the names of the persons that occupy a building.
friend ostream& operator<<(ostream& outs, const building&
name);
//Overloads the ==operator so that it returns true if two
buildings have the same
//number of persons otherwise false
friend bool operator==(const building& b1, const building& b2);
//Prints YOUR name, ID Number, Lecture and Lab section
in the following format
//<name><tab><ID><tab><Lecture><tab><Lab section>
//This will be used for marking purposes
void Identify_Writer( );
The file building.h
should contain the class definition,
The file building.cpp
should contain the implementation.
We provide a small driver program CheckBuilding.cpp
that can be compiled together with
building.h and building.cpp to test a few cases.
Note that this program DOES NOT cover all possible
test cases and is not the program that we will actually
use to compile your program
Create a file building.h with the class definition
Create a file building.cpp with the implementation.
Add your student name, student id, email, and lab section in the very beginning of every file as comment
Create a directory "assign1" and place files building.h and building.cpp under ~/comp151/assign1
Our system will collected the files under ~/comp151/assign1 on Monday 19
March at midnight.