Must use codeblocks C An IRS agent is checking taxpayers ret

Must use codeblocks
C++
An IRS agent is checking taxpayer’s returns in the $30,000.00 to $40,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 20.5% of the gross earnings, you are to compute the taxes due (assume all taxes are in the bracket of 20.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 20.5%, compute the refund due and leave a message to that effect. Records of gross earnings outside the range of $30,000.00 to $40,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:
1. The total number of records in the data file.
2. 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.
Must use codeblocks
C++
An IRS agent is checking taxpayer’s returns in the $30,000.00 to $40,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 20.5% of the gross earnings, you are to compute the taxes due (assume all taxes are in the bracket of 20.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 20.5%, compute the refund due and leave a message to that effect. Records of gross earnings outside the range of $30,000.00 to $40,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:
1. The total number of records in the data file.
2. 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.
Must use codeblocks
C++
An IRS agent is checking taxpayer’s returns in the $30,000.00 to $40,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 20.5% of the gross earnings, you are to compute the taxes due (assume all taxes are in the bracket of 20.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 20.5%, compute the refund due and leave a message to that effect. Records of gross earnings outside the range of $30,000.00 to $40,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:
1. The total number of records in the data file.
2. 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.

Solution

#include <iostream>
#include <fstream>
using namespace std;

    const int size=100;
  
    //read tax data from file and save into parallel arrauys
int readFromFile(int taxid[size],double earnings[size],double tax[size])
{
    int n=0;
    int tmp;
     ifstream myfile (\"earnings.txt\");
   if (myfile.is_open())
   {
       while(myfile>>tmp)
       {
           n++;
           taxid[n]=tmp;
           myfile>>earnings[n];
           myfile>>tax[n];
       }
       myfile.close();
    }
   else
   cout << \"Unable to open file\";
   return n;
}

//calculate tax based on conditions provided
void calTax(int n,int taxid[],double earnings[],double tax[],double refund[],double penalty[])
{
    cout<<\"\ ******Calculating tax*********\ \";
    //loop though each tax payer
    for(int i=0;i<=n;i++)
    {
        //display the detils ofe ach tx payer
            cout<<\"\ ID: \"<<taxid[i];
            cout<<\"\ Earnings: \"<<earnings[i];
            cout<<\"\ Tax Paid: \"<<tax[i];
            //if earnings aren\'t between 30K and 40K,just exit
        if(earnings[i]>30000 && earnings[i]<=40000)
        {
            cout<<\"\ You are currently outside the tax cal bracket. Hence,no tax ia calauclated.\";
        }
        //else actual tax calculation comes into picture
        else
        {
            //calculate taxtobe paid based on income and check if refund/penalty has to be initiated
            double taxToBePaid=earnings[i]*0.205;
            //if he has paid less tax
            if(tax[i]<taxToBePaid)
            {
                //caculate tax due
                double taxDue=taxToBePaid-tax[i];
                if(taxDue>1300)
                {
                    penalty[i]+=0.02*(taxDue-1300);
                }
                penalty[i]+=taxDue*.04;
                tax[i]+=penalty[i];
                cout<<\"\ Penalty of \"<<penalty[i]<<\" has to be paid. You new tax now is \"<<tax[i];
            }
            //else calculate refund amt
            else if(tax[i]>taxToBePaid)
            {
                refund[i]=tax[i]-taxToBePaid;
                cout<<\"\ Refund of \"<<refund[i] <<\"will be initiated\";
            }
        }
    }
        cout<<\"\ ******Calculating tax DONE*********\";
}

//get count of tax payers
int getTaxPayerinRange(int n,double penalty[])
{
    int count=0;
    for(int i=0;i<=n;i++)
    {
        if(penalty[i]==0)
        count++;
    }
    return count;
}

//get count of tax payers who has refund
int getTaxPayerRefund(int n,double refund[])
{
    int count=0;
    for(int i=0;i<=n;i++)
    {
        if(refund[i]>0)
        count++;
    }
    return count;
}

//get amt of refund amount
double getRefundAmt(int n,double refund[])
{
    double amt=0;
    for(int i=0;i<=n;i++)
    {
        if(refund[i]>0)
        amt+=refund[i];
    }
    return amt;
}

//get count of tax payers who pay penalty
int getTaxPayerPenalty(int n,double penalty[])
{
    int count=0;
    for(int i=0;i<=n;i++)
    {
        if(penalty[i]>0)
        count++;
    }
    return count;
}

//get penalty amount
double getPenaltyAmt(int n,double penalty[])
{
    double amt=0;
    for(int i=0;i<=n;i++)
    {
        if(penalty[i]>0)
        amt+=penalty[i];
    }
    return amt;
}

//get tax amt paid
double getTaxAmt(int n,double tax[])
{
    double amt=0;
    for(int i=0;i<=n;i++)
    {
        if(tax[i]>0)
        amt+=tax[i];
    }
    return amt;
}

//takes size of array and value and then computes average
double computeAvg(int n,double value)
{
    return value/n;
}

//display the report
void print(int n,double earnings[],double tax[],double refund[],double penalty[])
{
    cout<<\"\ The total number of records in the data file: \"<<n;
    cout<<\"\ The total number of taxpayer’s checked in range: \"<<getTaxPayerinRange(n,penalty);
    cout<<\"\ The total number of taxpayer’s receiving refunds: \"<<getTaxPayerRefund(n,refund);
    cout<<\"\ The total dollar amount refunded \"<<getRefundAmt(n,refund);
    cout<<\"\ The total number of taxpayer’s that owe taxes \"<<getTaxPayerPenalty(n,penalty);
    cout<<\"\ The total dollar amount of taxes due \"<<getTaxAmt(n,tax);
    cout<<\"\ The total dollar amount of penalties due \"<<getPenaltyAmt(n,penalty);
    cout<<\"\ The average dollar amount refunded \"<<computeAvg(getTaxPayerRefund(n,refund),getRefundAmt(n,refund));
    cout<<\"\ The average dollar amount of taxes due \"<<computeAvg(getTaxPayerinRange(n,penalty),getTaxAmt(n,tax));
    cout<<\"\ The average dollar amount of the penalties due \"<<computeAvg(getTaxPayerPenalty(n,penalty),getPenaltyAmt(n,penalty));
}

//main function
int main()
{
    //declare variables needed
    int n=-1;
    int taxid[size];
    double earnings[size];
    double tax[size];
    double refund[size];
    double penalty[size];
  
    //call required funcitons
    n=readFromFile(taxid,earnings,tax);
    calTax(n,taxid,earnings,tax,refund,penalty);
    print(n,earnings,tax,refund,penalty);
   return 0;
}

 Must use codeblocks C++ An IRS agent is checking taxpayer’s returns in the $30,000.00 to $40,000.00 income bracket (gross earnings). Each record of the data fi
 Must use codeblocks C++ An IRS agent is checking taxpayer’s returns in the $30,000.00 to $40,000.00 income bracket (gross earnings). Each record of the data fi
 Must use codeblocks C++ An IRS agent is checking taxpayer’s returns in the $30,000.00 to $40,000.00 income bracket (gross earnings). Each record of the data fi
 Must use codeblocks C++ An IRS agent is checking taxpayer’s returns in the $30,000.00 to $40,000.00 income bracket (gross earnings). Each record of the data fi
 Must use codeblocks C++ An IRS agent is checking taxpayer’s returns in the $30,000.00 to $40,000.00 income bracket (gross earnings). Each record of the data fi

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site