Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

//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.

image text in transcribed

/*

* @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 #include #include #include // Add additional headers here using namespace std;

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.00

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design

Authors: Marion Donnie Dutton Don F. Seaman

14th Edition Globel Edition

1292107634, 978-1292107639

More Books

Students also viewed these Databases questions

Question

identify various mental models about goals, AppendixLO1

Answered: 1 week ago