Question
include #include #include ProductionWorker.h using namespace std; void displayInfo(Productionworker); int main() { try { Productionworker pw(John Jones, 123, 1/1/2006, 3, 18.00); } catch(Productionworker::Invalidshift) { cout
include #include #include "ProductionWorker.h" using namespace std; void displayInfo(Productionworker); int main() { try { Productionworker pw("John Jones", "123", "1/1/2006", 3, 18.00); } catch(Productionworker::Invalidshift) { cout << "Invalid shift"; } displayInfo(pw); cin.get(); return 0; } I'm making a class though I have pw not declared and Invalid shift does not name a type. Please help me
Productionworker.h:
#ifndef PRODUCTIONWORKER_H
#define PRODUCTIONWORKER_H
#include "Employee.h"
using namespace std;
#include
class Productionworker : public Employee
{
private:
int shift;
double payRate;
public:
class invalidShift
{};
Productionworker() : Employee()
{ shift = 0 ; payRate = 0.0;
}
Productionworker (string cName, string cNumber, string cDate, int cShift,
double cPayRate):Employee ( cName, cNumber, cDate)
{ shift = cShift; cDate; cPayRate; }
void setShift(int s)
{ shift = s;
}
void setpayRate(double r)
{ payRate = r;
}
int getShiftNumber() const
{ return shift;
}
string getShiftName() const
{
if (shift == 1)
return "Day";
else if (shift == 2)
return "Night";
else
throw invalidShift();
}
double getPayRate() const
{
return payRate;
}
};
#endif
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