-
Notifications
You must be signed in to change notification settings - Fork 0
/
SportsBet.cpp
93 lines (77 loc) · 2.03 KB
/
SportsBet.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
//
// Created by Kavi Palmer on 1/4/22.
//
#include "SportsBet.h"
//return Date
Date SportsBet::getDate() const {
return gameDate;
}
//return odds
int SportsBet::getOdds() const {
return odds;
}
//return sport
std::string SportsBet::getSport() const {
return sport;
}
//return team bet Against
std::string SportsBet::getAgainst() const {
return betAgainst;
}
//return team bet for
std::string SportsBet::getFor() const {
return betFor;
}
//return direction of odds ('+' or '-')
char SportsBet::getOddsSymbol() const {
return oddsSymbol;
}
//sets odds symbol ('+' or '-')
void SportsBet::setOddsSymbol(const char &od) {
oddsSymbol = od;
}
//set team betting against
void SportsBet::setBetAgainst(const std::string &team) {
betAgainst = team;
}
//set team betting for
void SportsBet::setBetFor(const std::string &team) {
betFor = team;
}
//set date of game betting on
void SportsBet::setDate(const int &day, const int &month, const int &year) {
gameDate.setDate(month, day, year);
}
//set the odds of the bet
void SportsBet::setOdds(const int &od) {
odds = od;
}
//set the sport the bet is in
void SportsBet::setSport(const std::string &spt) {
sport = spt;
}
//return a string of a Moneyline bet
std::string SportsBet::toString() {
std::string dt = gameDate.toString();
std::string odd = std::to_string(odds);
std::string symbol;
if (oddsSymbol == '-')
symbol = "-";
else
symbol = "+";
std::string returnString = sport + "- Moneyline" + "\n" + betFor +" " + symbol + odd +" vs. " + betAgainst + "\nDate: " + dt;
return returnString;
}
//checks if param Sportsbet rhs is equal to this object
bool SportsBet::equals(const SportsBet &rhs) const {
return gameDate == rhs.gameDate &&
betFor == rhs.betFor &&
betAgainst == rhs.betAgainst &&
odds == rhs.odds &&
sport == rhs.sport &&
oddsSymbol == rhs.oddsSymbol;
}
//operator overload
bool SportsBet::operator==(const SportsBet &rhs) const {
return equals(rhs);
}