Customer Class Specifics

The Customer Class

Most of the customer class functions are standard functions that do computations and return strings that can be used by the interface to display various aspects of customer. The customer list is needed to maintain the deleted item used in the order class. It also has the function deleteAt which overrides the deleteAt of the array class. This is needed to store the deleted customer and that customer's number.

 CUSTOMER_CLASS Customer
{
public:
	enum Rating {BAD,GOOD};
	Customer(const string &name="",Rating rating=GOOD,const double &balance=0.0);
	void getTabString(char*)const;
	int operator ==(const Customer &)const;
	void upDateBalance(double amt){_balance+=amt;}//add amt to balance
	string name()const{return _name;}
	void balanceString(char*)const;
	Rating rating()const {return _rating;}
	double balance()const {return _balance;}
private:
	string _name;
	Rating _rating;
	double _balance;
};

typedef RcPointer CustPtr;
CUSTOMER_CLASS CustList :public Array
{
public:
	CustList(){}
	string getDeleteName()const;
	int getDeletedSub(){return _where;}
	CustPtr getDeletedPtr(){return _deleted;}
	void deleteAt(int);
private:
	CustPtr _deleted;
	int _where;
};
typedef RcPointer CustListPtr;

The deleteAt Function

void CustList::deleteAt( int w)
{
    _deleted = sub(w);
    deleteItemAt(w);
    _where = w;
}