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

The IRS needs to track of the number of who owes tax dollars each year. They wan

ID: 3831452 • Letter: T

Question

The IRS needs to track of the number of who owes tax dollars each year. They want an application to provided three options. Enter tax payer’s name, SSN, residential address and contact information and amount owed display the total of tax owed by state, and display the information about a particular tax payer.

1. Design two appropriate class header files that are

related(inheritance and/or object composition). A class header file

that contains constructor(s) and at least three function prototypes. The

classes designed will be used in a number of applications/projects, not

just in one project.

2. Select data structures such as STLs to create list(s) that

holds objects.

3. Develop the main() that contains object(s), and list of

object(s).

Explanation / Answer

Here are the class header files and main program. Since the question does not ask for full implementation of the classes in .cpp file, its not implemented. The class definitions in header will have to be implemented in a .cpp file in order for main to work.

taxpayer.h

#ifndef __TAXPAYER_H_
#define __TAXPAYER_H_
#include <iostream>
class TaxPayer
{
private:

std::string name;
unsigned int SSN;
std::string address;
std::string contact;
double taxOwed;

public:
TaxPayer(); //default constructor
TaxPayer(std::string name, unsigned int SSN); //constructor with 2 arguments
void setAddress(std::string address); //set the address
void setContact(std::string contact); //set contact
void setTaxOwed(double taxOwed); //set the tax owed
double getTaxOwed();//return the tax owed
std::string getName(); //get hte name
unsigned int getSSN(); //get ssn
std::string getAddress(); //get address
std::string getContact(); //get contact info

};
#endif

state.h

#ifndef __STATE_H_
#define __STATE_H_
#include "taxpayer.h"
#include <vector>
#include <iostream>
class State
{
private:
std::string stateName;
std::vector<TaxPayer> taxPayers;

public:

State();//constructor
State(std::string name);//constructor to intialize name
std::string getName();
void addTaxPayer(TaxPayer tp); // add a tax payer to the list
int getNumTaxPayers(); //get total number of tax payers
TaxPayer getTaxPayer(int i); //get the tax payer at index i
double getTotalTaxOwed(); //get the total of tax paid
void printTPList(); //print a list of tax payers
};
#endif

main.cpp


#include "taxpayer.h"
#include "state.h"
#include <vector>
#include <iostream>
using namespace std;
int main()
{
string choice;
string sname, tpname,address,contact;
unsigned int ssn;
double tax;
vector<State> statelist;

while(true)
{
cout<<"Enter state name: "<<endl;
cin>>sname;
State s(sname);

cout<<"Enter the list of tax payers:"<<endl;
while(true)
{
cout<<"Enter name:";
cin>>tpname;
cout<<"Enter SSN:";
cin>>ssn;
cout<<"Enter address:";
cin>>address;
cout<<"Enter contact:";
cin>>contact;
cout<<"Enter tax owed: ";
cin>>tax;
TaxPayer tp(tpname,ssn);
tp.setAddress(address);
tp.setContact(contact);
tp.setTaxOwed(tax);
s.addTaxPayer(tp);
cout<<"Add another tax payer? (y/n): ";
cin>>choice;
if(choice!="y")
break;
}

statelist.push_back(s);

cout<<"Add another state? (y/n):";
cin>>choice;
if(choice!="y")
break;
}

TaxPayer tp;
State s;
cout<<"Tax owed by states"<<endl;
for(int i=0; i<statelist.size(); i++)
{
s = statelist[i];
cout<<"State "<<s.getName()<<endl;
cout<<"_____________"<<endl;
cout<<"List of tax payers"<<endl;

for(int j=0; j<s.getNumTaxPayers(); j++)
{
tp = s.getTaxPayer(j);
cout<<tp.getName() << " " <<tp.getSSN() << " " << tp.getTaxOwed() <<endl;
}

cout<<"Total tax owed : "<<s.getTotalTaxOwed()<<endl<<endl;
}
}

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