-
Notifications
You must be signed in to change notification settings - Fork 4
/
Company.cpp
125 lines (99 loc) · 3.57 KB
/
Company.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#include "Company.h" // class implemented
using namespace std;
// File scope starts here
/////////////////////////////// PUBLIC ///////////////////////////////////////
//============================= LIFECYCLE ====================================
// Company Default+Overloaded Constructor
Company::Company(const string& aName, const string& aRegistrationNo) : mCompName(aName), mRegistrationNo(aRegistrationNo) {
this->SetCompany(aName, aRegistrationNo);
for (int i = 0; i < 50; i++) {
this->mRooms[i] = NULL;
this->mHalls[i] = NULL;
}
}
// end Company constructor
//============================= OPERATIONS ===================================
// function that prints profit report.
void Company::ProfitReport()const { }
// function that calculates financial statements.
void Company::FinancialStatement() { }
// function that prints rooms in the company.
void Company::PrintRooms() {
for (int i = 0; i < Company::msNoOfRooms; i++) {
cout << this->mRooms[i]->GetRoom();
}
}
//============================= ACESS ===================================
// function that sets name of the company
void Company::SetName(const string& aName) {
this->mCompName = aName;
}
// end function SetName
// function that sets registration no. of the company
void Company::SetRegistrationNo(const string& aRegistrationNo) {
this->mRegistrationNo = aRegistrationNo;
}
// end function SetRegistrationNo
// function that sets Rooms of Company
void Company::SetRoom(Room * aRoom) {
this->mRooms[Company::sGetTotalRooms()] = aRoom;
Company::msNoOfRooms++;
}
// end function SetRoom
// function that sets Halls of Company
void Company::SetHall(Hall * aHall) {
this->mHalls[Company::sGetTotalHalls()] = aHall;
Company::msNoOfHalls++;
}
// end function SetHall
// function that sets Company
void Company::SetCompany(const string& aName, const string& aRegistrationNo) {
this->SetName(aName);
this->SetRegistrationNo(aRegistrationNo);
}
// end function SetCompany
// Overloaded function that sets Company
void Company::SetCompany(const Company& aCompany) {
this->SetCompany(aCompany.GetName(), aCompany.GetRegistrationNo());
}
// end function SetCompany
// function that gets name of the company
const string& Company::GetName() const {
return this->mCompName;
}
// end function GetName
// function that gets registration no. of the company
const string& Company::GetRegistrationNo() const {
return this->mRegistrationNo;
}
// end function GetRegistrationNo
// function that gets rooms of the company
Room * Company::GetRoom() const {
return this->mRooms[0];
}
// end function GetRoom
// function that gets halls of the company
Hall * Company::GetHall() const {
return this->mHalls[0];
}
// end function GetHall
// function that gets the Company
const Company& Company::GetCompany()const {
return *this;
}
// end function GetCompany
// static function that gets the total no. of Rooms
int Company::sGetTotalRooms() {
return Company::msNoOfRooms;
}
// end function sGetTotalRooms
// static function that gets the total no. of Rooms
int Company::sGetTotalHalls() {
return Company::msNoOfHalls;
}
// end function sGetTotalHalls
/////////////////////////////// PRIVATE ///////////////////////////////////
//============================= DATA MEMBERS ============================
/*private static member cannot be accessed outside the class except for initialization*/
int Company::msNoOfRooms = 0; // intitalize class variable
int Company::msNoOfHalls = 0; // intitalize class variable