I have a payroll program due today and i cant figure out why I'm getting multiple errors, including an error in my iostream which has not been edited. please help! here are the codes for the .cpp and the .h files. the compfun.cpp in the cpp file is just for the rounding function. I havent finished typing it but after building it this far i thought it would be a good idea to address the issues now instead of later when there is more problems. Thanks!
.cpp first:
Code:
#include "weeklyEMP.h"
#include <iostream>
#include <string>
#include "compfun.cpp"
using namespace std;
const double WEEKLY_ALLOWANCE = 39.42;
const double FICA_TAX_RATE = 0.0765;
weeklyEMP::weeklyEMP()
{
initName = "";
initHours = 0.0;
initRate = 0.0;
initExemptions = 0;
initFilingStatus = "";
}
weeklyEMP::weeklyEMP(string initName, double initHours, double initRate, int initExemptions, string initFilingStatus)
{
my_name = initName;
my_hours = initHours;
my_rate = initRate;
my_exemptions = initExemptions;
my_filingStatus = initFilingStatus;
}
void weeklyEMP::set_hours(double thisWeeksHours)
{
my_hours = thisWeeksHours;
}
void weeklyEMP::set_rate(double thisWeeksRate)
{
my_rate = thisWeeksRate;
}
weeklyEMP::double grossPay() const;
{
if(my_hours <=40)
return my_hours * my_rate;
else
return (40*my_rate) + (my_hours-40) * 1.5 * my_rate;
}
weeklyEMP::double incomeTax() const;
{
double result(0.0);
double taxableIncome(grossPay() - my_exemptions * WEEKLY_ALLOWANCE);
if(my_filingStatus == "S" || my_filingStatus == "s")
{
if (taxableIncome <= 23.00)
result = 0.00;
else if(taxableIncome <= 397.00)
result = 0.15 * (taxableIncome - 23.00);
else if(taxableIncome <= 928.00)
result = 56.10 + 0.28 * (taxableIncome - 397.00);
else if(taxableIncome <= 2121.00)
result = 204.78 + 0.33 * (taxableIncome - 928.00);
else
result = 598.47 + 0.28 * (taxableIncome - 2121.00);
}
if(my_filingStatus == "M" || my_filingStatus == "m")
{
if(taxableIncome <= 65.00)
result = 0.00;
else if(taxableIncome <= 689.00)
result = 0.15 * (taxableIncome - 65.00);
else if(taxableIncome <= 1573.00)
result = 93.60 + 0.28 * (taxableIncome - 689.00);
else if(taxableIncome <= 3858.00)
result = 341.12 + 0.33 * (taxableIncome - 1573.00);
else
result = 1095.17 + 0.28 * (taxableIncome - 3858.00);
}
result = round(result, 2);
return result;
}
double FICATax() const;
{
return grossPay() * FICA_TAX_RATE;
}
string name() const;
{
return my_name();
}
That is all i have so far for the .cpp. Here is the .h file
Code:
#ifndef weeklyemp_H // Avoid redeclaring class bankAccount.
#define weeklyemp_H // This code is compiled only once
#include <string> // for class string
using namespace std;
class weeklyEmp
{
public:
weeklyEmp();
weeklyEmp(string initName, double initHours, double initRate, int initExemptions, string initFilingStatus);
void set_hours(double thisWeeksHours);
void set_rate(double thisWeeksRate);
double grossPay() const;
double incomeTax() const;
double FICATax() const;
string name() const;
private:
string my_name;
double my_hours;
double my_rate;
int my_exemptions;
string my_filingStatus;
}
#endif
this file should be done right now but is still comming up with errors. some are syntex, some say weeklyEMP is not a class, it just seems that the .cpp file isnt loading the .h file. any suggestions?