-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDeclaration.cpp
60 lines (54 loc) · 1021 Bytes
/
Declaration.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
#include "Declaration.h"
Declaration::Declaration(string fn, int a)
{
fullname = fn;
age = a;
}
Declaration::Declaration(string fn, int a, vector<Residence*> res)
{
fullname = fn;
age = a;
residences = res;
}
void Declaration::addResidence(Residence *res)
{
residences.push_back(res);
}
void Declaration::display()
{
cout << "Fullname: " << fullname << endl;
cout << "Age: " << age << endl;
cout << "Residences:" << endl;
cout << "-------------" << endl;
for (unsigned i = 0; i < residences.size(); i++)
{
residences.at(i)->display();
cout << endl;
}
}
bool Declaration::Area300()
{
int total_area = 0;
for (unsigned i = 0; i < residences.size(); i++)
{
total_area += residences.at(i)->getArea();
}
if (total_area > 300)
{
return true;
}
return false;
}
double Declaration::TotalTax()
{
double total_tax = 0.0;
for (unsigned i = 0; i < residences.size(); i++)
{
total_tax += 1.4 * residences.at(i)->getArea();
}
if (Area300())
{
total_tax += 1500;
}
return total_tax;
}