-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHome.cpp
30 lines (23 loc) · 800 Bytes
/
Home.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
/* Home class source file */
#include "Home.h"
// constructor
Home::Home(string n, int s, float d, float c, float l)
: InsurancePolicy(n),
sqft(s), dwellingCoverage(d), contentsCoverage(c), liability(l)
{}
// calculate commission
void Home::calcCommission()
{
commission = (liability * 0.3) + \
((dwellingCoverage + contentsCoverage) * 0.2);
}
// print method -- used in overloaded << stream operator
void Home::print(ostream &strm) const
{
cout << "Name of insured: " << name << endl;
cout << "House square footage: " << sqft << endl;
cout << "Dwelling coverage: " << dwellingCoverage << endl;
cout << "Contents coverage: " << contentsCoverage << endl;
cout << "Liability coverage: " << liability << endl;
cout << "Commission: " << commission << endl;
}