I'm having a lot of issues wring codes in C++ specialy when 3 files are required (.h, .cpp and main.cpp). Very different to C that it was very easy for me but not now with C++.
I nee to write a program to do the following:
Create 3 files for this program. Taxpayer.h, Taxpayer.cpp, and main.cpp
Create a class called Taxpayer. Data members (private variables)include a social security number, a full name, a yearly gross income, and the tax owed.
Your class should have a constructor that takes in a name, social security number, and a yearly gross income.
Provide get and set methods for all the data members.
The set methods should do validation:
Make sure numbers entered are not negative. Make them zero if they are.
Make sure names entered are not blank, if it is default to "No Name"
Make sure social security number, has appropriate number of digits, if it doesn't default to "123-45-6789"
The tax should be calculated whenever the income is set. The tax has this formula:
15% for incomes under $30,000
28.5% for incomes $30,000 or higher.
**main program **
Should ask for TaxPayers in a loop. Keep allowing taxpayers to be entered, until they enter QUIT for the name.
Once the user is done entering values, your program should ask the user for a taxpayer to search on: If the taxpayer exists, print out their social, income, and taxOwed. If the taxpayer does not exist, print that out. Also, print out all the taxpayers in the same tax bracket as the taxpayer searched on
Allow users to search until they enter QUIT
Sample Execution:
Enter Tax Payer Name (QUIT to Quit): Mike Stevens
Enter SSN for Mike Stevens: 123-33-3333
Enter Income for Mike Stevens: 45000
Enter Tax Payer Name (QUIT to Quit): Cindy Etter
Enter SSN for Cindy Etter: 123-33-3334
Enter Income for Cindy Etter: 95000
Enter Tax Payer Name (QUIT to Quit): Joe Blake
Enter SSN for Joe Blake: 123-33-3337
Enter Income for Joe Blake: 25000
Enter Tax Payer Name (QUIT to Quit): QUIT
Enter Tax Payer Name to Search For (QUIT to Quit): Mr. K
Rebecca is not found.
Enter Tax Payer Name to Search For (QUIT to Quit): Cindy Etter
Social Security Number: 123-33-3334
Income: $95000
Tax Owed: $27075
Other Tax Payers in this same bracket: Mike Stevens
Enter Tax Payer Name to Search For (QUIT to Quit): QUIT