LAB 9 C++ COMPLETE THE C++ PROGRAM: #include #include #include #include \"Date.h
ID: 3688271 • Letter: L
Question
LAB 9 C++
COMPLETE THE C++ PROGRAM:
#include
#include
#include
#include "Date.h"
#include "Employee.h"
using namespace std;
/* the Employee constructor to assign
the rate of pay and calls the function
newHire to get employee information */
Employee::Employee(double rate)
{
__________ = _____;//
________();
}
/* the Employee member method pay to
calculate the weekly pay amount */
void Employee::pay()
{
double hoursWorked, payAmount;
______ << "How many hours did " << ___________ << ' '
<< _____________<< " work this week? ";
______ >> ___________;
payAmount = _________ * _________;
if (_____________> 40)
payAmount += (___________ - 40) * __________ * .5;
cout << " Weekly pay for " << ______________ << ' '
<< ____________ << " is $" << setprecision(2)
<< fixed << showpoint << ______________ << endl;
}
/* The Employee member method eeo to report
employee ethnicity */
void Employee::eeo()
{
____ << "The employee ethnicity is " ;
switch(____________)
{
case '__': _____ << "_____________. ";
break;
case '__': _____ << "_______________. ";
break;
case '__': ____ << "_______________. ";
break;
case '__': _____ << "_____________. ";
break;
case '__': cout << "________________. ";
}
}
/* The Employee member method newHire to
gather new employee information */
void Employee::newHire()
{
// prompt user for first name and last name
______ << "Enter first name and last name separated "
<< "by a space: ";
// enter first name and last name of employee
____>> ___________ >> ________________;
cin.ignore();
// prompt use for starting date
___ << "Please enter starting date mm dd yyyy for " << ______
<< ' ' << _________ << ": ";
________._____________();
// prompt for ethnicity
______ << "Please enter your ethnicity: (C)aucasian, (A)frican American, "
"(N)ative American, (H)ispanic, A(s)ian, (O)ther: ";
_____ >> _____________;
cin.ignore();
________ = toupper(_____________);
cout << endl;
}
Explanation / Answer
#include <iostream>
#include <iomanip>
#include <string>
#include "Employee.h"
#include "Date.h"
using namespacestd;
/* the Employee constructor to assign
the rate of pay and calls the function
newHire to get employee information */
Employee::Employee(double rate)
{
this.rate =rate;
newHire();
}
/* the Employee member method pay to
calculate the weekly pay amount */
void Employee::pay()
{
double hoursWorked, payAmount;
cout << "How many hours did " << firstName << ' '
<< lastName << " work this week? ";
cin >> hoursWorked;
payAmount = rate * hoursWorked;
if (hoursWorked> 40)
payAmount += (hoursWorked - 40) * hoursWorked * .5;
cout << " Weekly pay for " << firstName << ' '
<< lastName << " is $" << setprecision(2)
<< fixed << showpoint << payAmount << endl;
}
/* The Employee member method eeo to report
employee ethnicity */
void Employee::eeo()
{
cout << "The employee ethnicity is " ;
switch(ethinicity)
{
case 'C': cout << "Caucasian. ";
break;
case 'A': cout << "African American. ";
break;
case 'N': cout << "Native American. ";
break;
case 'H': cout << "Hispanic. ";
break;
case 'S': cout << "Asian. ";
}
}
/* The Employee member method newHire to
gather new employee information */
void Employee::newHire()
{
// prompt user for first name and last name
cout << "Enter first name and last name separated "
<< "by a space: ";
// enter first name and last name of employee
cin >> firstName >> lastName;
cin.ignore();
// prompt use for starting date
cout << "Please enter starting date mm dd yyyy for " << firstName
<< ' ' << lastName << ": ";
cin >> date;
cin.ignore();
// prompt for ethnicity
cout << "Please enter your ethnicity: (C)aucasian, (A)frican American, "
"(N)ative American, (H)ispanic, A(s)ian, (O)ther: ";
cin >> ethnicity;
cin.ignore();
ethnicity = toupper(ethnicity);
cout << endl;
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.