Question

In: Computer Science

An IRS agent is checking taxpayer’s returns in the $30,000.00 to $40,000.00 income bracket (gross earnings).

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.

Solutions

Expert Solution

#include
#include
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<<"\n******Calculating tax*********\n";
    //loop though each tax payer
    for(int i=0;i<=n;i++)
    {
        //display the detils ofe ach tx payer
            cout<<"\nID: "<             cout<<"\nEarnings: "<             cout<<"\nTax Paid: "<             //if earnings aren't between 30K and 40K,just exit
        if(earnings[i]>30000 && earnings[i]<=40000)
        {
            cout<<"\nYou 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]             {
                //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<<"\nPenalty of "<             }
            //else calculate refund amt
            else if(tax[i]>taxToBePaid)
            {
                refund[i]=tax[i]-taxToBePaid;
                cout<<"\nRefund of "<             }
        }
    }
        cout<<"\n******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<<"\nThe total number of records in the data file: "<     cout<<"\nThe total number of taxpayer’s checked in range: "<     cout<<"\nThe total number of taxpayer’s receiving refunds: "<     cout<<"\nThe total dollar amount refunded "<     cout<<"\nThe total number of taxpayer’s that owe taxes "<     cout<<"\nThe total dollar amount of taxes due "<     cout<<"\nThe total dollar amount of penalties due "<     cout<<"\nThe average dollar amount refunded "<     cout<<"\nThe average dollar amount of taxes due "<     cout<<"\nThe average dollar amount of the penalties due "< }

//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;
}


Related Solutions

The IRS reports that 15% of returns where the adjusted gross income is more than $1,000,000 will be subject
The IRS reports that 15% of returns where the adjusted gross income is more than $1,000,000 will be subject to a computer audit. For the year 2017, Fred Friendly, CPA, completed 16 returns where the adjusted gross income was more than $1,000,000.a. What is the probability exactly one of these returns will be audited?b. What is the probability at least one will be audited?
For each of the following scenarios, determine the amount included in the taxpayer’s gross income for...
For each of the following scenarios, determine the amount included in the taxpayer’s gross income for 2019: Office Supplies, Inc., an accrual basis taxpayer, leases a copying machine to a new customer on December 23, 2019. The machine was to rent for $250 per month for a period of 24 months beginning January 1, 2020. The customer was required to prepay 2 months’ rent at the time the lease was signed on December 23,2019. The customer was also required to...
Determine the taxpayer’s gross income for tax purposes in each of the following situations: Deb, a...
Determine the taxpayer’s gross income for tax purposes in each of the following situations: Deb, a cash basis taxpayer, traded a corporate bond with accrued interest of $300 for corporate stock with a fair market value of $12,000 at the time of the exchange. Deb’s cost of the bond was $10,000. The value of the stock had decreased to $11,000 by the end of the year. Deb needed $10,000 to make a down payment on her house. She instructed her...
INCOME STATEMENT: 2016 2017 Sales $100,000.00 $120,300.00 Cost of Goods Sold $60,000.00 $72,180.00 Gross Margin $40,000.00...
INCOME STATEMENT: 2016 2017 Sales $100,000.00 $120,300.00 Cost of Goods Sold $60,000.00 $72,180.00 Gross Margin $40,000.00 $48,120.00 Depreciation $16,000.00 $19,200.00 Administrative Costs $9,000.00 $10,800.00 EBIT $15,000.00 $18,120.00 Interest $4,000.00 $4,000.00 Pre-tax income $11,000.00 $14,120.00 Taxes $4,400.00 $5,648.00 Net Income $6,600.00 $8,472.00 Dividends $0.00 $5,083.20 Addition to Retained Earnings $6,600.00 $3,388.80 BALANCE SHEET AS OF 12/31/2017: ASSETS 2016 2017 Cash $5,000.00 $6,000.00 Inventory $15,000.00 $18,000.00 Accounts Receivable $15,000.00 $18,045.00 Current Assets $35,000.00 $42,045.00 Net PPE $80,000.00 $92,000.00 Total Assets (TA) $115,000.00...
Sonya Fuentez, an IRS-enrolled agent, is preparing an annual income tax return for Carlito Alverez. Sonya...
Sonya Fuentez, an IRS-enrolled agent, is preparing an annual income tax return for Carlito Alverez. Sonya is a little apprehensive about the engagement because she’s heard rumor that Alverez is a major drug trafficker with roots in Colombia. At Alverez’s request, Sonya visits his home to discuss the details of his return. When she arrives, she’s shocked by the opulence she sees. The house is on 2 acres of land just west of the Intracoastal Waterway in Miami Beach. The...
Sonya Fuentez, an IRS-enrolled agent, is preparing an annual income tax return for Carlito Alverez. Sonya...
Sonya Fuentez, an IRS-enrolled agent, is preparing an annual income tax return for Carlito Alverez. Sonya is a little apprehensive about the engagement because she’s heard rumor that Alverez is a major drug trafficker with roots in Colombia. At Alverez’s request, Sonya visits his home to discuss the details of his return. When she arrives, she’s shocked by the opulence she sees. The house is on 2 acres of land just west of the Intracoastal Waterway in Miami Beach. The...
According to the IRS, individuals filing federal income tax returns prior to March 31 received an...
According to the IRS, individuals filing federal income tax returns prior to March 31 received an average refund of $1056 in 2018. Consider the population of “last-minute” filers who mail their tax return during the last five days of the income tax period (typically April 10 to April 15). A researcher suggests that a reason individuals wait until the last five days is that on average these individuals receive lower refunds than do early filers. For a sample of 400...
Terry makes $2400$2400 per month in gross income. His net earnings are 80%80% of his gross....
Terry makes $2400$2400 per month in gross income. His net earnings are 80%80% of his gross. His utility bills total $150.$150. What percentage of Terry's net earnings is he spending on utilities?
You have gross earnings of $2,370 per week and a Federal Income Tax rate of 24%....
You have gross earnings of $2,370 per week and a Federal Income Tax rate of 24%. You have voluntary deductions. What are your net earnings per week?
Nancy has W-2 gross earnings of $137000. A total of $9700 of her income was deferred...
Nancy has W-2 gross earnings of $137000. A total of $9700 of her income was deferred to her company's retirement plan, and $5800 was used to pay for her health-care premiums. What will be her W-2 taxable income?.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT