Question: #ifndef BASEPLUS_H #define BASEPLUS_H #include // C++ standard string class class BasePlusCommissionEmployee { public: BasePlusCommissionEmployee( const std::string &, const std::string &, const std::string &, double

#ifndef BASEPLUS_H #define BASEPLUS_H
#include
class BasePlusCommissionEmployee { public: BasePlusCommissionEmployee( const std::string &, const std::string &, const std::string &, double = 0.0, double = 0.0, double = 0.0 ); void setFirstName( const std::string & ); // set first name std::string getFirstName() const; // return first name
void setLastName( const std::string & ); // set last name std::string getLastName() const; // return last name
void setSocialSecurityNumber( const std::string & ); // set SSN std::string getSocialSecurityNumber() const; // return SSN
void setGrossSales( double ); // set gross sales amount double getGrossSales() const; // return gross sales amount
void setCommissionRate( double ); // set commission rate double getCommissionRate() const; // return commission rate
void setBaseSalary( double ); // set base salary double getBaseSalary() const; // return base salary
double earnings() const; // calculate earnings void print() const; // print BasePlusCommissionEmployee object private: std::string firstName; std::string lastName; std::string socialSecurityNumber; double grossSales; // gross weekly sales double commissionRate; // commission percentage double baseSalary; // base salary }; // end class BasePlusCommissionEmployee
#endif
---------------------------------------------------------------------
#include
// constructor BasePlusCommissionEmployee::BasePlusCommissionEmployee( const string &first, const string &last, const string &ssn, double sales, double rate, double salary ) { firstName = first; // should validate lastName = last; // should validate socialSecurityNumber = ssn; // should validate setGrossSales( sales ); // validate and store gross sales setCommissionRate( rate ); // validate and store commission rate setBaseSalary( salary ); // validate and store base salary } // end BasePlusCommissionEmployee constructor
// set first name void BasePlusCommissionEmployee::setFirstName( const string &first ) { firstName = first; // should validate } // end function setFirstName
// return first name string BasePlusCommissionEmployee::getFirstName() const { return firstName; } // end function getFirstName
// set last name void BasePlusCommissionEmployee::setLastName( const string &last ) { lastName = last; // should validate } // end function setLastName
// return last name string BasePlusCommissionEmployee::getLastName() const { return lastName; } // end function getLastName
// set social security number void BasePlusCommissionEmployee::setSocialSecurityNumber( const string &ssn ) { socialSecurityNumber = ssn; // should validate } // end function setSocialSecurityNumber
// return social security number string BasePlusCommissionEmployee::getSocialSecurityNumber() const { return socialSecurityNumber; } // end function getSocialSecurityNumber
// set gross sales amount void BasePlusCommissionEmployee::setGrossSales( double sales ) { if ( sales >= 0.0 ) grossSales = sales; else throw invalid_argument( "Gross sales must be >= 0.0" ); } // end function setGrossSales
// return gross sales amount double BasePlusCommissionEmployee::getGrossSales() const { return grossSales; } // end function getGrossSales
// set commission rate void BasePlusCommissionEmployee::setCommissionRate( double rate ) { if ( rate > 0.0 && rate 0.0 and
// return commission rate double BasePlusCommissionEmployee::getCommissionRate() const { return commissionRate; } // end function getCommissionRate
// set base salary void BasePlusCommissionEmployee::setBaseSalary( double salary ) { if ( salary >= 0.0 ) baseSalary = salary; else throw invalid_argument( "Salary must be >= 0.0" ); } // end function setBaseSalary
// return base salary double BasePlusCommissionEmployee::getBaseSalary() const { return baseSalary; } // end function getBaseSalary
// calculate earnings double BasePlusCommissionEmployee::earnings() const { return baseSalary + ( commissionRate * grossSales ); } // end function earnings
// print BasePlusCommissionEmployee object void BasePlusCommissionEmployee::print() const { cout
--------------------------------------------------------------
#include
int main() { // instantiate BasePlusCommissionEmployee object BasePlusCommissionEmployee employee( "Bob", "Lewis", "333-33-3333", 5000, .04, 300 ); // set floating-point output formatting cout
// get commission employee data cout
employee.setBaseSalary( 1000 ); // set base salary
cout In this assignment you will modify the BasePlusCommissionEmployee code figures 11.7 thru 11.9 to handle a new class of employees that receive Per Diem pay for a special project. Per Diem pay is a flat amount per day that each employee gets in addition to the salary and commission. Per Diem pay cannot be a negative number but can be zero. Per Diem is added to earnings after base salary and commissions are calculated The output that is displayed to the user should show all of the information that is currently in BasePlusCommissionEmployee plus the amount of the Per Diem that they received
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
