Question
//can anyone help me make this its not fully done but i got some stuff so far. /* * @file h44.h * @author Your name
//can anyone help me make this its not fully done but i got some stuff so far.
/*
* @file h44.h
* @author Your name goes here
* @version what day and meeting time
*/
#ifndef H44_H_
#define H44_H_
#include
/////// Declare all of your classes here ////////////////
class Worker
{
public:
//virtual inline destructor
virtual ~Worker(){}
Worker(const std::string& name, double rate);
std::string getName() const;
double getRate() const;
//abstract function
virtual std::string payInfo(int hours) const = 0;
//in SalariedWorker
virtual std::string payInfo(int hours);
private:
std::string name;
double rate;
};
#endif
-----------------------------------------------
/** @file h44.cpp @author your name here @version what day and meeting time */ #include
string STUDENT = " "; // Add your Canvas/occ-email ID
#include "h44.h"
// Add your implementation here
string SalariedWorker::payInfo(int hours) { return ""; }
Your Turn: Virtual Workers of the World, Arise! Upload the starter code to your workspace. For this assignment, you will need to create an abstract base class Worker. Every worker has a name and an hourly rate (along with the appropriate accessor methods). The Worker class should have a pure virtual payInfo(int hours) function that returns the worker's name and computed salary as a formatted string. You'll also need to create two derived concrete classes Hourlyworker and Salaried- Worker. An hourly worker gets paid the hourly wage for the actual number of hours worked for the first 40 hours and time and a half for any hours over that. The salaried (aka "exempt) worker gets paid the hourly wage for 40 hours, no matter what the actu- al number of hours is. The test program that I've written tests your classes by creating four Worker pointers and then pointing each to a different derived class. It then calls the payInfo() function for each worker, using different hours (less than and more than 40 hours) Here's some sample output: Sam (Hourly, $ 20.00) worked 20 hours. Pay: 400.00 Tom (Salaried, $ 30.00) worked 20 hours. Pay: $ 1200.00Step 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