Question
Employee.cpp // Implementation file for the Employee class #include Employee.h #include using namespace std; int Employee::lastEmployeeNumberIssued=0; // Sequential employee number // Default constructor Employee::Employee() {
Employee.cpp
// Implementation file for the Employee class
#include "Employee.h"
#include
using namespace std;
int Employee::lastEmployeeNumberIssued=0; // Sequential employee number
// Default constructor
Employee::Employee()
{
lastEmployeeNumberIssued++;
employeeNumber = lastEmployeeNumberIssued;
employeeName = "";
hireDate = "";
}
// Constructor
Employee::Employee(string aName, string aDate)
{
lastEmployeeNumberIssued++;
employeeNumber = lastEmployeeNumberIssued;
employeeName = aName;
hireDate = aDate;
}
// Mutators
void Employee::setEmployeeName(string n)
{
employeeName = n;
}
void Employee::setHireDate(string date)
{
hireDate = date;
}
// Accessors
string Employee::getEmployeeName() const
{
return employeeName;
}
int Employee::getEmployeeNumber() const
{
return employeeNumber;
}
string Employee::getHireDate() const
{
return hireDate;
}
int Employee::getLastEmployeeNumberIssued()
{
return lastEmployeeNumberIssued;
}
Employee Class Modify the Employee class: Add an exception class: Add code to the Employee class to check if hire date string object fits the numeric format. One easy way to accomplish this is to use the "square brackets" operator access individual characters in the hire date string: InvalidHireDate MM/DD/YYYY 1)to 1. The hire date string should have a length of 10. 2 The characters at index 2 and index 5 should be a forward-slash character ( ). 3. The characters at index 0, 1, 3, 4, 6, 7, 8, and 9 should be in the range of 0..9. (Refer to the isdigit) function in the cetype function library. You may need to adda #include
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