Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

main.cpp #include #include employee.h using namespace std; void PrintEmployeeInfo(const Employee& e); int main() { Employee joe(37, Joe Brown, 123 Main St., 123-6788, 10.00, 45.00); Employee

image text in transcribedimage text in transcribedimage text in transcribed

main.cpp

#include #include "employee.h"

using namespace std;

void PrintEmployeeInfo(const Employee& e);

int main() { Employee joe(37, "Joe Brown", "123 Main St.", "123-6788", 10.00, 45.00); Employee sam(38, "Sam Jones", "45 East State", "661-9000", 12.50, 30.00);

PrintEmployeeInfo(joe); joe.PrintCheck();

PrintEmployeeInfo(sam); sam.PrintCheck();

return 0; }

void PrintEmployeeInfo(const Employee& e) { cout

employee.cpp

#include #include "employee.h"

using namespace std;

Employee::Employee(int employeeNumber, string name, string address, string phone, double hourlyWage, double hoursWorked) : name(name), address(address), phone(phone) { this->employeeNumber = employeeNumber; this->hourlyWage = hourlyWage; this->hoursWorked = hoursWorked; }

int Employee::GetEmployeeNumber() const { return employeeNumber; }

string Employee::GetName() const { return name; }

string Employee::GetAddress() const { return address; }

string Employee::GetPhone() const { return phone; }

double Employee::GetHourlyWage() const { return hourlyWage; }

double Employee::GetHoursWorked() const { return hoursWorked; }

void Employee::SetName(string name) { this->name = name; }

void Employee::SetAddress(string address) { this->address = address; }

void Employee::SetPhone(string phone) { this->phone = phone; }

void Employee::SetHourlyWage(double hourlyWage) { this->hourlyWage = hourlyWage; }

void Employee::SetHoursWorked(double hoursWorked) { this->hoursWorked = hoursWorked; }

double Employee::CalcPay() const { double baseHours = (hoursWorked >= 40.0 ? 40.0 : hoursWorked); double overTime = (hoursWorked >= 40.0 ? (hoursWorked - 40.0) : 0); double grossPay = (baseHours * hourlyWage) + (overTime * hourlyWage * 1.5);

double fedTax = grossPay * 0.20; double stateTax = grossPay * 0.075; return grossPay - fedTax - stateTax; }

// Uses void Employee::PrintCheck() const { cout.setf(ios::showpoint); cout.setf(ios::fixed); cout.precision(2);

cout

employee.h

#ifndef EMPLOYEE_H #define EMPLOYEE_H

#include

class Employee { public: Employee(int employeeNumber, std::string name, std::string address, std::string phone, double hourlyWage, double hoursWorked); int GetEmployeeNumber() const; std::string GetName() const; std::string GetAddress() const; std::string GetPhone() const; double GetHourlyWage() const; double GetHoursWorked() const; void SetName(std::string name); void SetAddress(std::string address); void SetPhone(std::string phone); void SetHourlyWage(double hourlyWage); void SetHoursWorked(double hoursWorked); double CalcPay() const; void PrintCheck() const;

private: int employeeNumber; std::string name; std::string address; std::string phone; double hourlyWage; double hoursWorked; };

#endif // EMPLOYEE_H

image text in transcribed

I need help this is the code I have so far I keep Getting these errors shown above and don't understand what I need to change

1: Test Parameterized Constructor and Getters 0/10 Compilation failed main.cpp: In function 'bool testPassed(std::ofstream&)' main.cpp: 19:10: error: class Employee' has no member named 'getEmploye Compilation failed if (emp.getEmployeeNumber!- 123) 2: const functions ^ 0/5 All Getters', calcPay0.and printCheck0 must be declared as const Test feedback getName () not defined const 3: Test Setters 0/10 Compilation failed main.cpp: In function 'bool testPassed (std::ofstream&) main.cpp: 19:6: error class Employee' has no member named 'setName d emp.setName ("Thomas Doggett") main.cpp: 20:6: error: class Employee has no member named 'setAddr' d emp.setAddr ("Braintree, MA" main.cpp: 21:6: error class Employee' has no member named 'setPhone emp.setPhone ("disconnected") main.cpp: 22:6: error: class Employee has no member named 'setHourlyWa emp.setHourlyWage (0.99); main.cpp: 23:6: error: class Employee has no member named 'setHoursWorl emp.setHoursWorked (5000.0) Compilation failed main.cpp: 26:10: error: 'class Employee' has no member named 'getName if (emp.getName )-"Thomas Doggett") main.cpp: 32:10: error: 'class Employee' has no member named 'getAddr if (emp . getAddr() != "Braintree, MA") main.cpp: 38:10: error: 'class Employee' has no member named 'getPhone if (emp.getPhone () !"disconnected") main.cpp: 44:10: error:'class Employee' has no member named getHourlyW if (emp.getHourlyWage() 0.99) main.cpp: 50:10: error: 'class Employee' has no member named 'getHoursWo : Test calcPay0 0/10 Compilation failed main.cpp: In function 'bool testPassed (std::ofstream&)' main.cpp:20:10: error: 'class Employee' has no member named 'calcPay' if (emp.calcPay)-8700.0 main.cpp:27:6: error: class Employee' has no member named 'setHoursWorl Compilation failed emp.setHoursWorked (43.5) main.cpp:28:10: error: 'class Employee' has no member named calcPay' if (emp.calcPayO-32806.25) Current file: employee.h employee.cpp employee.h main.cpp

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

Step: 3

blur-text-image

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

Oracle RMAN For Absolute Beginners

Authors: Darl Kuhn

1st Edition

1484207637, 9781484207635

More Books

Students also viewed these Databases questions