diff --git a/07-heaps/Customer.h b/07-heaps/Customer.h index b186886..a70e117 100644 --- a/07-heaps/Customer.h +++ b/07-heaps/Customer.h @@ -27,14 +27,16 @@ public: Customer() : year(0), mileage(0), seq(0), name("") {}; Customer(int y, int m, int s, string n) : year(y), mileage(m), seq(s), name(std::move(n)) { - priority = mileage / 1000 + year - seq; - serial = priority * 100 + (100 - seq); + priority = calcPriority(); + serial = calcSerial(); }; - int getPriority() const { return priority; } + int calcPriority() { return mileage / 1000 + year - seq; } int getSerial() const { return serial; } + int calcSerial() { return priority * 100 + (100 - seq); } + friend ostream &operator<<(ostream &os, const Customer &c) { os << c.year << " " << c.mileage << " (" << c.getSerial() << ") [" << c.name << "]"; return os;