-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAgent.cpp
More file actions
53 lines (47 loc) · 1.85 KB
/
Agent.cpp
File metadata and controls
53 lines (47 loc) · 1.85 KB
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
#include "Agent.h"
#include <iostream>
using namespace std;
Agent::Agent(string name, Seller* contactedSellers[], Buyer* contactedBuyers[]){
this->name = name;
// assigning the list
for (int i = 0; i < 3; i++){
this->contactedSellers[i] = contactedSellers[i];
}
for (int i = 0; i < 2; i++){
this->contactedBuyers[i] = contactedBuyers[i];
}
}
void Agent::recordOffer(listingDetails tempList)
{
this->listOfProperties.ownedProperty = tempList.ownedProperty;
this->listOfProperties.sellingPrice = tempList.sellingPrice;
this->listOfProperties.date = tempList.date;
this->listOfProperties.soldStatus = tempList.soldStatus;
}
void Agent::contactSeller(int listingNum, double price)
{ // the additions to the function allow the agent to choose which seller to contact about which house with the offer
listedProperties[listingNum].mostRecentOffer = price;
bool sellerDecision = contactedSellers[listingNum]->respondOffer(price, listedProperties[listingNum].ownedProperty);
listedProperties[listingNum].soldStatus = sellerDecision;
}
void Agent::modifyListing(Property* p1, int sPrice, string date, bool status)
{
listedProperties[count].ownedProperty = p1;
listedProperties[count].sellingPrice = sPrice;
listedProperties[count].date = date;
listedProperties[count].soldStatus = status;
listedProperties[count].mostRecentOffer = 0;
count = count + 1;
}
void Agent::printList()
{
for (int i = 0; i < 3; i++){
cout << listedProperties[i].ownedProperty->getType() << endl;
cout << listedProperties[i].sellingPrice << endl;
cout << listedProperties[i].date << endl;
string forSaleResult = listedProperties[i].soldStatus ? "Sold!" : "For Sale";
cout << forSaleResult << endl;
cout << listedProperties[i].mostRecentOffer << endl;
cout << endl;
}
}