Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please complete the following code for the classes below based on the last table that defines the purpose of each function. Figure 3 shows the
Please complete the following code for the classes below based on the last table that defines the purpose of each function. Figure 3 shows the expected output of the code.
The class Part TimeStaff and FullTimeStaff in Figure 1 are used to represent information about staff doing sales job in a company in part time and full time categories. The full time staff get their salary from the fixed monthly salary stored in m_salary) and added with bonus. The bonus for full time staff is given if their total monthly sales exceed their fixed monthly base salary. The part time staff gets their monthly salary from a percentage of the monthly sales made. Implement all the member function for the class Staff, Part TimeStaff and FullTimeStaff. Refer to main() function in Figure 2 for your reference. Sample execution of the output produced by the main() function is given in Figure 3. The main() function and all the classes definition must not be changed. class Staff { protected: string m_name; float m_totalMonthlySales; // sales made in RM float m_salary; // fixed monthly base salary public: Staff() {} virtual float calculateMonthlySalary() = 0; virtual void showStaffInfo()=0; void setTotalSales (float nSale); class PartTimeStaff : public Staff { public: virtual float calculateMonthlySalary(); virtual void showStaffInfo(); PartTimeStaff(string name); friend bool operator>(Part TimeStaff s1, PartTimeStaff p2); class FullTimeStaff : public Staff { float m_bonus; // calculated public: virtual float calculateMonthlySalary(); virtual void showStaffInfo(); FullTimeStaff(string name, float salary); Figure 1 int main() { Staff* ptr = new FullTimeStaff("Daniel", 3000); ptr->setTotalSales (10000); ptr->showStaffInfo(); // cout getBaseSalary(); deleted cout calculateMonthlySalary(); ptr = new PartTimeStaff("Jim"); ptr->setTotalSales (24000); ptr->showStaffInfo(); cout calculateMonthlySalary(); " s2) cout (Part TimeStaff si, Part TimeStaff s2) Compare total monthly sales value for part time staff s1 and s2. Return true if the sales value obtained by staff sl is more than staff s2 else return false. Draw UML class diagram Draw UML class diagram for the class Staff, PartTimeStaff and FullTime Staff
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started