-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLocation.cpp
99 lines (86 loc) · 2.42 KB
/
Location.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
#include "Location.h"
Location::Location() {
name = "";
type = "";
}
Location::~Location() {
}
Location::Location(string locName, string locType) {
name = locName;
type = locType;
}
string Location::getName() const { return name; }
string Location::getType() const { return type; }
Property::Property() {
price = 0;
owner = 0;
}
Property::Property(int buyPrice, int ownedBy) {
price = buyPrice;
owner = ownedBy;
}
Property::~Property() {
}
Corner::Corner(string name) {
this->name = name;
}
ChanceCC::ChanceCC(string name) {
this->name = name;
}
Tax::Tax(string name) {
this->name = name;
}
int Property::getPrice() const { return price; }
int Property::getOwner() const { return owner; }
void Property::setOwner(int playerNum) { owner = playerNum; }
Regular::Regular(string name, int Rent, int H1Rent, int H2Rent, int H3Rent, int H4Rent, int H5Rent, int HPrice, string Color) {
rent = Rent;
house1Rent = H1Rent;
house2Rent = H2Rent;
house3Rent = H3Rent;
house4Rent = H4Rent;
hotelRent = H5Rent;
housePrice = HPrice;
colorGroup = Color;
type = "Regular";
this->name = name;
}
int Regular::getRent() const { return rent; }
int Regular::getH1Rent() const { return house1Rent; }
int Regular::getH2Rent() const { return house2Rent; }
int Regular::getH3Rent() const { return house3Rent; }
int Regular::getH4Rent() const { return house4Rent; }
int Regular::getH5Rent() const { return hotelRent; }
int Regular::getHPrice() const { return housePrice; }
string Regular::getColor() const { return colorGroup; }
Utility::Utility() {
ownBoth = false;
}
Utility::Utility(string locName, int price) {
name = locName;
this->price = price;
}
int Utility::calculateRent(int diceTotal) {
int rent;
rent = (checkOwnBoth()) ? (diceTotal * 10) : (diceTotal * 4);
return rent;
}
void Utility::setOwnBoth(bool bothOwned) { ownBoth = true; }
bool Utility::checkOwnBoth() const { return ownBoth; }
Railroad::Railroad() {
numOwned = 0;
}
Railroad::Railroad(string name) {
numOwned = 0;
this->name = name;
}
int Railroad::calculateRent() {
int rent;
if (getNumOwned() == 1) { rent = 25; }
else if (getNumOwned() == 2) { rent = 50; }
else if (getNumOwned() == 3) { rent = 100; }
else if (getNumOwned() == 4) { rent = 200; }
return rent;
}
void Railroad::setNumOwned(int numOwn) { numOwned = numOwn; }
int Railroad::getNumOwned() const { return numOwned; }