Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Answer this inheritance question base on the following .cpp.files.You will need

ID: 3772484 • Letter: A

Question

Answer this inheritance question base on the following .cpp.files.You will need to create another files to complete these in visual studio c++

BiweeklyTaxpayer.h
#ifndef BIWEEKTAXPAYER_H_
#define BIWEEKTAXPAYER_H_

#include "Taxpayer.h"
#include <string>
using namespace std;

class BiweeklyTaxpayer : public Taxpayer
{
public:
BiweeklyTaxpayer();
BiweeklyTaxpayer(string nm, string ssn, double gp);
void computeStateTax();
void computeFederalTax();
string getClassName();
};


#endif

BiweeklyTaxpayer.cpp
#include "BiweeklyTaxpayer.h"

#include <string>
using namespace std;


BiweeklyTaxpayer::BiweeklyTaxpayer():Taxpayer()
{
className = "Biweekly Taxpayer";
}
BiweeklyTaxpayer::BiweeklyTaxpayer(string nm, string ssn, double gp): Taxpayer(nm,ssn,gp)
{
className = "Biweekly Taxpayer";
(*this).computeStateTax();
(*this).computeFederalTax();
}
void BiweeklyTaxpayer::computeStateTax()
{
if (0 <= getGrossPay() && getGrossPay() < 308.0) //1
nys = getGrossPay() * 0.04;
else if (308 <= getGrossPay() && getGrossPay() < 423) //2
nys = (getGrossPay() -308) * 0.0450 + 12.31;
else if (423 <= getGrossPay() && getGrossPay() < 500) //3
nys = (getGrossPay() - 423) * 0.0525 + 17.50;
else if (500 <= getGrossPay() && getGrossPay() < 769) //4
nys = (getGrossPay() - 500) * 0.0590 + 21.54;
else if (769 <= getGrossPay() && getGrossPay() < 3462) //5
nys = (getGrossPay() - 769) * 0.0685 + 37.42;
else if (3462 <= getGrossPay() && getGrossPay() < 3846) //6
nys = (getGrossPay() - 3462) * 0.0764 + 221.85;
else if (3846 <= getGrossPay() && getGrossPay() < 5769) //7
nys = (getGrossPay() - 3846) * 0.0814 + 251.23;
else if (5769 <= getGrossPay()) //8
nys = (getGrossPay() - 5769) * 0.0935 + 407.85;

nys = ((int)(nys*100))/100.0;

}
void BiweeklyTaxpayer::computeFederalTax()
{
double exempt = 0;
exempt = getGrossPay() - 130.77;

if (0 <= exempt && exempt <= 51)
fed = 0;
else if (51 < exempt && exempt <= 195)
fed = (exempt - 51)* 0.10;
else if (195 < exempt && exempt <= 645)
fed = (exempt - 195) * 0.15 + 14.40;
else if (645 < exempt && exempt <= 1482)
fed = (exempt - 645) * 0.25 + 81.90;
else if (1482 < exempt && exempt <= 3131)
fed = (exempt - 1482) * 0.28 + 291.15;
else if (3131 < exempt && exempt <= 6763)
fed = (exempt - 3131) * 0.33 + 752.87;
else if (6763 < exempt )
fed = (exempt - 6763) * 0.35 + 1951.43;

fed = ((int)(fed*100))/100.0;
}

string BiweeklyTaxpayer::getClassName()
{
return className;
}

The creation of a simple hierarchy of classes along with implementation and use of
inheritance.

CODE: Level 1: Taxpayer
Level 2: WeeklyTaxpayer BiweeklyTaxpayer MonthlyTaxpayer
The program should create instances of the WeeklyTaxpayer, BiweeklyTaxpayer, and
MonthlyTaxpayer classes, which are described below. The program should not create
instances of the Taxpayer class. The client should work correctly for all suclasses.
THE FOLLOWING CLASS ( BIWEEKLY) HAS BEEN COMPLETED; YOU ARE TO CREATE
THE WEEKLY AND MONTHLY TAXPAYERS IN A SIMILAR FASHION
Create a new class, called BiweeklyTaxpayer, that is a subclass of Taxpayer.
This new class must be in a separate file with the same name as the class.
The BiweeklyTaxpayer class must inherit all the member variables of theTaxpayer class.
Do not declare any member variables in the Biweekly Taxpayer class
The BiweeklyTaxpayer class must have a public constructor that takes a value for each of the
inherited member variables as parameter.
The inherited variables are: name, SSN number, and gross pay.
The constructor must invoke the constructor of the parent class to initialize the variables.
The BiweeklyTaxpayer class must have a public computeStateTax member function that
calculates tax by the rules provided below

See example for computing NYS tax after the monthly calculation.

Example for NYS tax calculation:If the gross pay is $700 and monthly,find where it fits in the table.This would be row 2 (667 to 917).Subtract the amount 667 from the gross pay. This is the adjusted pay(33).Multiply the adjusted pay by the corresponding rate found in row 2 of the NYS rates(0.0450).Now add the amount26.27 to that product(26.27+1.485).This the NYS tax,27.76.

Modification One:

Implement the member function for Biweekly state tax calculation: Write the code for the member function named computeStateTax()

Calculate tax as follows:

Modification Two:

Implement the member functions for Weekly State tax calculation. Write the code for the member function named computeStateTax()

Calculate tax as follows:

WEEKLY PAYROLL:

Gross Wages at Least

But Less Than

Subtract This Amount From Net Wages

Multiply The Result by Corresponding Rates and Add The result to the Following.Then Withhold The Sum

Modification Three:

Implement the member function for Monthly Tax calculation: Write the code for the following member function named computeStateTax()

Calculate tax as follows:

MONTHLY PAYROLL

Subtract This Amount From Net Wages

Multiply The Result by Corresponding Rates and Add The result to the Following.Then Withhold The Sum

Example for NYS tax calculation: If the gross pay is $700 and monthly, find where it fits in the table

This would be row 2(667 to917).

Subtract the amount 667 from the gross pay. This is the adjusted pay.Multiply the adjusted pay by the corresponding rate found in row 2 of the NYS rates(0.0450).Now add the amount 26.27 to that product(26.27+1.485)

This is the NYS tax,27.76

MODIFICATION Four

Add the computeFederalTax member function for ALL the classes. Write the code for the member function named computeFederalTax() member function of the existing program classes.The member function must calculate tax as follows:(see example after tables)

CORRESPONDING FEDERAL RATES

FEDERAL

FEDERAL WITHHOLDING ALLOWANCE

ALLOW ONLY ONE AMOUNT

Example for Federal tax calculation: If the gross pay is $700 and monthly, then subtract the monthly allowance of 283.33 from the gross pay.Take this adjusted pay,416.67 and find where it fits into the table under? wages?allowance? This would be row 3(195 to 645).The corresponding rate is then row 3 in the rate table at 15%. Adjust pay again by subtracting (row 3 column 5) 195(416.67-195). Take15% of the adjusted pay(221.67) and add $14.40 to the amount.(33.25+14.40=47.65)

This is your Federal Tax.

Example for NYS Tax Calculation: If the gross pay is $700 and biweekly.

Find where it fits in the table.

This would be row 4(500 to769). Subtract the amount 500(row 4 col 4) from gross pay.This is the adjusted pay(200). Multiply the adjusted pay by the corresponding rate found in row 4 of the NYS rates (0.0590).

Now add the amount 21.54 to that product(11.80+21.54). This is the NYS tax,33.34 Note that you always work from row 4 once you have determined that is where the gross pay fits in the table.

The BiweeklyTaxpayer class must have a public computeFederalTax member function that calculates tax by the rules provided above.

Example for Federal tax calculation: If the gross pay is $700 and biweekly, then subtract the biweekly allowance of 130.77 form the gross pay. Take this adjusted pay,569.23 and find where it fits into the table under wages allowance. This would be row 3(195 to 645). Adjust pay again by subtracting (row 3 column 5) 195 (569.23-195). The corresponding rate is then on row 3 in the rate table at 15%. Take 15% of the adjusted pay(374.23) and add $14.40 to the amount(56.13+14.40=70.53).This is your federal tax. Note that you always work from row 3 once you have determined that is where the gross pay minus the exemption fits in the table

C++ project- USE VISUAL STUDIO COMPILER

1 0.0400 2 0.0450 3 0.0525 4 0.0590 5 0.0685 6 0.0764 7 0.0814 8 0.0935

Explanation / Answer

/*Programs: each program should be entered in seperate file. You have to use the TaxPayer.h also, that is already with you*/

//BiweeklyTaxpayer.h
#ifndef BIWEEKTAXPAYER_H_
#define BIWEEKTAXPAYER_H_
#include "Taxpayer.h"
#include <string>
using namespace std;
class BiweeklyTaxpayer : public Taxpayer
{
public:
BiweeklyTaxpayer();
BiweeklyTaxpayer(string nm, string ssn, double gp);
void computeStateTax();
void computeFederalTax();
string getClassName();
};

#endif
/*--------------------------------------------------------------*/
//WeeklyTaxpayer.h
#ifndef WEEKLYTAXPAYER_H_
#define WEEKLYTAXPAYER_H_
#include "Taxpayer.h"
#include <string>
using namespace std;
class WeeklyTaxpayer : public Taxpayer
{
public:
WeeklyTaxpayer();
WeeklyTaxpayer(string nm, string ssn, double gp);
void computeStateTax();
void computeFederalTax();
string getClassName();
};
#endif

/*--------------------------------------------------------------*/
//MonthlyTaxpayer.h
#ifndef MONTHLYTAXPAYER_H_
#define MONTHLYTAXPAYER_H_
#include "Taxpayer.h"
#include <string>
using namespace std;
class MonthlyTaxpayer : public Taxpayer
{
public:
MonthlyTaxpayer();
MonthlyTaxpayer(string nm, string ssn, double gp);
void computeStateTax();
void computeFederalTax();
string getClassName();
};
#endif
/*--------------------------------------------------------------*/

//BiweeklyTaxpayer.cpp
#include "BiweeklyTaxpayer.h"
#include <string>
using namespace std;

BiweeklyTaxpayer::BiweeklyTaxpayer():Taxpayer()
{
className = "Biweekly Taxpayer";
}
BiweeklyTaxpayer::BiweeklyTaxpayer(string nm, string ssn, double gp): Taxpayer(nm,ssn,gp)
{
className = "Biweekly Taxpayer";
(*this).computeStateTax();
(*this).computeFederalTax();
}
void BiweeklyTaxpayer::computeStateTax()
{
if (0 <= getGrossPay() && getGrossPay() < 308.0) //1
nys = getGrossPay() * 0.04;
else if (308 <= getGrossPay() && getGrossPay() < 423) //2
nys = (getGrossPay() -308) * 0.0450 + 12.31;
else if (423 <= getGrossPay() && getGrossPay() < 500) //3
nys = (getGrossPay() - 423) * 0.0525 + 17.50;
else if (500 <= getGrossPay() && getGrossPay() < 769) //4
nys = (getGrossPay() - 500) * 0.0590 + 21.54;
else if (769 <= getGrossPay() && getGrossPay() < 3462) //5
nys = (getGrossPay() - 769) * 0.0685 + 37.42;
else if (3462 <= getGrossPay() && getGrossPay() < 3846) //6
nys = (getGrossPay() - 3462) * 0.0764 + 221.85;
else if (3846 <= getGrossPay() && getGrossPay() < 5769) //7
nys = (getGrossPay() - 3846) * 0.0814 + 251.23;
else if (5769 <= getGrossPay()) //8
nys = (getGrossPay() - 5769) * 0.0935 + 407.85;
nys = ((int)(nys*100))/100.0;
}

void BiweeklyTaxpayer::computeFederalTax()
{
double exempt = 0;
exempt = getGrossPay() - 130.77;
if (0 <= exempt && exempt <= 51)
fed = 0;
else if (51 < exempt && exempt <= 195)
fed = (exempt - 51)* 0.10;
else if (195 < exempt && exempt <= 645)
fed = (exempt - 195) * 0.15 + 14.40;
else if (645 < exempt && exempt <= 1482)
fed = (exempt - 645) * 0.25 + 81.90;
else if (1482 < exempt && exempt <= 3131)
fed = (exempt - 1482) * 0.28 + 291.15;
else if (3131 < exempt && exempt <= 6763)
fed = (exempt - 3131) * 0.33 + 752.87;
else if (6763 < exempt )
fed = (exempt - 6763) * 0.35 + 1951.43;
fed = ((int)(fed*100))/100.0;
}

string BiweeklyTaxpayer::getClassName()
{
return className;
}
/*-----------------------------------------------------*/
//WeeklyTaxpayer.cpp
#include "WeeklyTaxpayer.h"
#include <string>
using namespace std;

WeeklyTaxpayer::WeeklyTaxpayer():Taxpayer()
{
className = "Weekly Taxpayer";
}
WeeklyTaxpayer::WeeklyTaxpayer(string nm, string ssn, double gp): Taxpayer(nm,ssn,gp)
{
className = "Weekly Taxpayer";
(*this).computeStateTax();
(*this).computeFederalTax();
}
string WeeklyTaxpayer::getClassName()
{
return className;
}

void WeeklyTaxpayer::computeStateTax()
{
if (0 <= getGrossPay() && getGrossPay() < 154.0) //1
nys = getGrossPay() * 0.04;
else if (154 <= getGrossPay() && getGrossPay() < 212) //2
nys = (getGrossPay() -154) * 0.0450 + 6.15;
else if (212 <= getGrossPay() && getGrossPay() < 250) //3
nys = (getGrossPay() - 212) * 0.0525 + 8.75;
else if (250 <= getGrossPay() && getGrossPay() < 385) //4
nys = (getGrossPay() - 250) * 0.0590 + 10.77;
else if (385 <= getGrossPay() && getGrossPay() < 1731) //5
nys = (getGrossPay() - 385) * 0.0685 + 18.71;
else if (1731 <= getGrossPay() && getGrossPay() < 1923) //6
nys = (getGrossPay() - 1731) * 0.0764 + 110.92;
else if (1923 <= getGrossPay() && getGrossPay() < 2885) //7
nys = (getGrossPay() - 1923) * 0.0814 + 125.62;
else if (2885 <= getGrossPay()) //8
nys = (getGrossPay() - 2885) * 0.0935 + 203.92;
  
nys = ((int)(nys*100))/100.0;
}
void WeeklyTaxpayer::computeFederalTax()
{
double exempt = 0;
exempt = getGrossPay() - 65.38;
if (0 <= exempt && exempt <= 51)
fed = 0;
else if (51 < exempt && exempt <= 195)
fed = (exempt - 51)* 0.10;
else if (195 < exempt && exempt <= 645)
fed = (exempt - 195) * 0.15 + 14.40;
else if (645 < exempt && exempt <= 1482)
fed = (exempt - 645) * 0.25 + 81.90;
else if (1482 < exempt && exempt <= 3131)
fed = (exempt - 1482) * 0.28 + 291.15;
else if (3131 < exempt && exempt <= 6763)
fed = (exempt - 3131) * 0.33 + 752.87;
else if (6763 < exempt )
fed = (exempt - 6763) * 0.35 + 1951.43;
fed = ((int)(fed*100))/100.0;
}
/*******************************************************/
//MonthlyTaxpayer.cpp
#include "MonthlyTaxpayer.h"
#include <string>
using namespace std;

MonthlyTaxpayer::MonthlyTaxpayer():Taxpayer()
{
className = "Weekly Taxpayer";
}
MonthlyTaxpayer::MonthlyTaxpayer(string nm, string ssn, double gp): Taxpayer(nm,ssn,gp)
{
className = "Monthly Taxpayer";
(*this).computeStateTax();
(*this).computeFederalTax();
}
string MonthlyTaxpayer::getClassName()
{
return className;
}

void MonthlyTaxpayer::computeStateTax()
{
if (0 <= getGrossPay() && getGrossPay() < 667.0) //1
nys = getGrossPay() * 0.04;
else if (667 <= getGrossPay() && getGrossPay() < 917) //2
nys = (getGrossPay() -667) * 0.0450 + 26.27;
else if (917 <= getGrossPay() && getGrossPay() < 1083) //3
nys = (getGrossPay() - 917) * 0.0525 + 37.92;
else if (1083 <= getGrossPay() && getGrossPay() < 385) //4
nys = (getGrossPay() - 1083) * 0.0590 + 46.67;
else if (1667 <= getGrossPay() && getGrossPay() < 1731) //5
nys = (getGrossPay() - 1667) * 0.0685 + 81.08;
else if (7500 <= getGrossPay() && getGrossPay() < 1923) //6
nys = (getGrossPay() - 7500) * 0.0764 + 480.67;
else if (8333 <= getGrossPay() && getGrossPay() < 2885) //7
nys = (getGrossPay() - 8333) * 0.0814 + 544.33;
else if (12500 <= getGrossPay()) //8
nys = (getGrossPay() - 12500) * 0.0935 + 883.67;
  
nys = ((int)(nys*100))/100.0;
}
void MonthlyTaxpayer::computeFederalTax()
{
double exempt = 0;
exempt = getGrossPay() - 283.33;
if (0 <= exempt && exempt <= 51)
fed = 0;
else if (51 < exempt && exempt <= 195)
fed = (exempt - 51)* 0.10;
else if (195 < exempt && exempt <= 645)
fed = (exempt - 195) * 0.15 + 14.40;
else if (645 < exempt && exempt <= 1482)
fed = (exempt - 645) * 0.25 + 81.90;
else if (1482 < exempt && exempt <= 3131)
fed = (exempt - 1482) * 0.28 + 291.15;
else if (3131 < exempt && exempt <= 6763)
fed = (exempt - 3131) * 0.33 + 752.87;
else if (6763 < exempt )
fed = (exempt - 6763) * 0.35 + 1951.43;
fed = ((int)(fed*100))/100.0;
}
/***********************************************************/

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote