#ifndef PIECEWORK_H #define PIECEWORK_H #include"employee.h" class PieceWork : public Employee{ private: float pieces; float payPerPiece; enum { piecework=2}; static float m_groupGross; public: PieceWork(char * last="",char *first="",float NumPieces=0,float ppp=0,float deff=0): pieces(NumPieces>0?NumPieces:0),payPerPiece(ppp>0?ppp:0),Employee(last,first,deff){} PieceWork(PieceWork &p): pieces(p.getPieces()),payPerPiece(p.getPayPerPiece()),Employee(p.getLastName(),p.getFirstName(),p.getDeffered()){} void setPayPerPiece(const float f){(f>0)?payPerPiece=f:payPerPiece=0;} void setPieces(const float f){(f>0)?pieces=f:pieces=0;} float getPayPerPiece(void)const{return payPerPiece;} float getPieces(void)const{return pieces;} void initGroupGross() { m_groupGross = 0; } float getGroupGross(){ return m_groupGross;} virtual void calcGross(); virtual int GetType() const { return piecework;} void printTitle(FILE* r) { fprintf(r,"\nPieceWork Employees\n"); } void printSubTotal(FILE* r) { fprintf(r,"\n-------------------------------"); fprintf(r,"\n Groups Gross :%6.2f",m_groupGross); } }; float PieceWork::m_groupGross = 0; void PieceWork::calcGross() { setGross(pieces*payPerPiece); m_groupGross += (pieces*payPerPiece); } #endif