An IRS agent is checking taxpayer\'s returns in the $20,000.00 to $30,000.00 inc
ID: 674332 • Letter: A
Question
An IRS agent is checking taxpayer's returns in the $20,000.00 to $30,000.00 income bracket (gross earnings). Each record of the data file contains a tax identification number (four digits), gross earnings, and the amount of taxes paid for the year. If the taxes paid are below 16.5% of the gross earnings, you are to compute the taxes due (assume all taxes are in the bracket of 16.5% of gross earnings). If there are taxes due a penalty charge of 4% is added to the amount. If the taxes due exceed $1,300.00 an additional 2.0% penalty charge is added to the amount over $1,300.00. For those that paid more than the 16.5%, compute the refund due and leave a message to that effect. Records of gross earnings outside the range of $20,000.00 to S30,000.00 are not checked and an appropriate message must be printed to that effect. Your program must also generate a summary report containing the following information: The total number of records in the data file. 2. 1. The total number of taxpayer's checked in range. 3. The total number of taxpayer's receiving refunds 4. The total dollar amount refunded. 5. The total number of taxpayer's that owe taxes. 6· The total dollar amount of taxes due. 7. The total dollar amount of penalties due. 8. The average dollar amount refunded 9. The average dollar amount of taxes due. 10. The average dollar amount of the penalties due. Note: You must use functions for the following: 1. The headings. 2. One function to compute the averages. (called three times) 3. Print the summary report. 4. Other functions may be used were you deemed appropriate. Submit your source code and algorithm or flowchart in blackboard. All values must be clearly labeled in the output. You are required to demonstrate your output in Lab. The data file: IRSDATA.TXT can be found in blackboard under Assignment 4 materials. Documentation will be 20% of your grade. Your source code must contain the following documentation. 2. 3. 4. Header information: (Source Code and Output) Your Name, course & section number, assignment number and due date A brief description of your assignment. Variable dictionary: A brief description of every variable used in your program Comments related to input and output of data and all formulas used in your code.Explanation / Answer
CODE :
#include<fstream.h>
#include<iomanip.h>
int main()
{
const double HiTax = 0.33; // income tax rates
const double MidTax = 0.28;
const double LoTax = 0.15;
const double SSRate = 0.0683; // ssi tax rate
const double HiBasic = 150.00; // insurance fees
const double MidBasic = 100.00;
const double LoBasic = 70.00;
const double HiDeluxe = 250.00;
const double MidDeluxe = 180.00;
const double LoDeluxe = 140.00;
const double HiIncome = 3000.00; // income levels
const double MidIncome = 1000.00;
const char Basic = 'B'; // insurance plan type codes
const char Deluxe = 'D';
ifstream inPay; // input file stream
ofstream outPay; // output file stream
int IdNum, // employee ID number
Age, // age
NumEmployees; // number of employees
double GrossPay, // employee gross pay
NetPay, // net pay
SSI, // SS tax
FIT, // income tax
InsFee, // insurance fee
TotalGross, // total of all gross pay
TotalNet, // net pay
TotalIns, // insurance fees
TotalSSI, // SSI tax
TotalFIT; // income tax
char InsPlan; // employee insurance plan
NumEmployees = 0; // Initialize counters and running totals
TotalGross = 0.0; // to zero.
TotalNet = 0.0;
TotalIns = 0.0;
TotalSSI = 0.0;
TotalFIT = 0.0;
inPay.open(“workers.dat”); // open input and output files
outPay.open(“payola.dat”);
outPay.setf(ios::fixed, ios::floatfield);
outPay.setf(ios::showpoint);
outPay << “ ID Gross Pay FIT SSI Ins” << “ Net Pay”;
outPay << endl;
outPay << “==============================================” << “==============”;
outPay << endl;
inPay >> IdNum >> Age >> GrossPay>> InsPlan;
while (inPay) {
NumEmployees++; // Count employees.
TotalGross += GrossPay; // Update total gross pay.
switch (InsPlan) {
case Basic:{ if (Age <= 35) // for Basic plan
InsFee = LoBasic;
else if (Age <= 65)
InsFee = MidBasic;
else InsFee = HiBasic;
break;
}
case Deluxe:{
if (Age <= 35) // for Deluxe plan
InsFee = LoDeluxe;
else if (Age <= 65)
InsFee = MidDeluxe;
else InsFee = HiDeluxe;
break; }
default :{
cout << "Employee " << setw(4) << IdNum;
cout << " has invalid insurance plan." << endl;
InsFee = 0.0; } }
TotalIns += InsFee; // Update total insurance fees.
if (GrossPay <= MidIncome)
{
FI T = LoTax * GrossPay;
} else
if (GrossPay <= HiIncome)
{ FIT = LoTax * MidIncome + MidTax * (GrossPay - MidIncome); }
else {
FIT = LoTax * MidIncome + MidTax * (HiIncome - MidIncome) + HiTax * (GrossPay - HiIncome); }
TotalFIT += FIT;
SSI = SSRate * GrossPay;
TotalSSI += SSI;
NetPay = GrossPay - InsFee - FIT - SSI;
TotalNet += NetPay;
outPay << setw( 6) << IdNum;
outPay << setw(12) << setprecision(2) << GrossPay;
outPay << setw(10) << setprecision(2) << FIT;
outPay << setw(10) << setprecision(2) << SSI;
outPay << setw(10) << setprecision(2) << InsFee;
outPay << setw(12) << setprecision(2) << NetPay;
outPay << endl;
inPay.ignore(200, ' ');
inPay >> IdNum >> Age >> GrossPay >> InsPlan; }
outPay << “============================================” << “================”;
outPay << endl;
if (NumEmployees > 0)
{
outPay << " Avg:";
outPay << setprecision(2);
outPay << setw(12) << TotalGross/NumEmployees;
outPay << setw(10) << TotalFIT/NumEmployees;
outPay << setw(10) << TotalSSI/NumEmployees;
outPay << setw(10) << TotalIns/NumEmployees;
outPay << setw(12) << TotalNet/NumEmployees;
outPay << endl; }
inPay.close();
outPay.close();
return NumEmployees;
}
ALGORITHM :
while more data (repeat the following)
if hours worked exceeds 40
(then) calculate pay using overtime pay calculation
otherwise calculate pay using regular pay calculation
calculate cumulative pay disbursed so far
print the pay statement for this set of data
get (next) data
print cumulative pay disbursed