47 lines
999 B
C++
47 lines
999 B
C++
/* *~*~*
|
|
Specification file for the Customer class
|
|
Written By: Iurii Tatishchev
|
|
Changed by: Iurii Tatishchev
|
|
IDE: CLion
|
|
*~**/
|
|
#ifndef CUSTOMER_H_
|
|
#define CUSTOMER_H_
|
|
|
|
#include <utility>
|
|
|
|
using std::string, std::ostream;
|
|
|
|
class Customer; // Forward Declaration
|
|
|
|
class Customer {
|
|
private:
|
|
int year;
|
|
int mileage;
|
|
int seq;
|
|
string name;
|
|
|
|
int priority;
|
|
int serial;
|
|
|
|
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 = calcPriority();
|
|
serial = calcSerial();
|
|
};
|
|
|
|
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;
|
|
}
|
|
};
|
|
|
|
#endif
|