include cstdlib include Bid using namespace std Bid Bid void email amo

 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
#include <cstdlib>
#include "Bid.h"
using namespace std;
Bid::Bid(void) :
email(""), amount(-1.0),
quantity(1), date() {}
Bid::Bid(const Bid &b) :
email(b.email), amount(b.amount),
quantity(b.quantity), date(b.date) {}
Bid::Bid (string email, float amount, int quantity, Date date) :
email(email), amount(amount),
quantity(quantity), date(date) {}
void Bid::setEmail(const string& email) {
this->email = email;
}
void Bid::setDate(const Date& date) {
this->date = date;
}
void Bid::setAmount(const float& amount) {
this->amount = amount;
}
void Bid::setQuantity(const int& quantity) {
this->quantity = quantity;
}
float Bid::getAmount() const {
return amount;
}
string Bid::getEmail() const{
return email;
}
Date Bid::getDate() const {
return date;
}
int Bid::getQuantity() const {
return quantity;
}
bool Bid::operator< (const Bid& rhs) const {
return (this->getAmount() < rhs.getAmount());
}
bool Bid::operator== (const Bid& rhs) const {
return (this->getAmount() == rhs.getAmount());
}
istream &operator>>(istream &stream, Bid &b) {
char line[80];
string name;
stream.getline(line, 80);
b.setEmail(line);
stream.getline(line, 80);
b.setAmount(atof(line));
stream.getline(line, 80);
b.setQuantity(atoi(line));
Date d;
stream >> d;
b.setDate(d);
return stream;
}