-
Notifications
You must be signed in to change notification settings - Fork 0
/
DeliveryMan.cpp
36 lines (29 loc) · 883 Bytes
/
DeliveryMan.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
#include "DeliveryMan.h"
DeliveryMan::DeliveryMan(const std::string &name, const unsigned int &capacity, const unsigned int &deliveryTime) : maxCapacity(capacity), deliveryTime(deliveryTime), name(name)
{
this->currentCapacity = maxCapacity;
}
unsigned int DeliveryMan::getDeliveryTime() const
{
return this->deliveryTime;
}
const std::string &DeliveryMan::getName() const
{
return this->name;
}
void DeliveryMan::reduceCapacity(const unsigned int &capacityChange)
{
this->currentCapacity -= capacityChange;
}
void DeliveryMan::reset()
{
this->currentCapacity = this->maxCapacity;
}
unsigned int DeliveryMan::getCapacity() const
{
return this->currentCapacity;
}
bool DeliveryMan::operator<(const DeliveryMan &dm) const
{
return this->maxCapacity < dm.maxCapacity || (this->maxCapacity == dm.maxCapacity && this->deliveryTime > dm.deliveryTime);
}