// File: Piece1.cpp // Member function definitions for class PieceWorker #include "piece1.h" // Constructor for class PieceWorker PieceWorker::PieceWorker(string first, string last, double wage, int quantity) : Employee( first, last ) // call base-class constructor { setWage(wage); setQuantity(quantity); } // Set the wage void PieceWorker::setWage(double w) { wagePerPiece = w > 0 ? w : 0; } // Set the number of items output void PieceWorker::setQuantity(int q) { quantity = q > 0 ? q : 0; } // Determine the PieceWorker's earnings double PieceWorker::earnings() const { return quantity * wagePerPiece; } // Print the PieceWorker's name void PieceWorker::print(ostream &dest) const { dest << "\n Piece worker: "; Employee::print(dest); }