IRS Tax data

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 18.5% of the gross earnings, you are to compute the taxes due (assume all taxes are in the bracket of 18.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,400.00 an additional 1.0% penalty charge is added to the amount over $1,400.00. For those that paid more than the 18.5%, compute the refund due and leave a message to that effect. Records of gross earnings outside the range of $20,000.00 to $30,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.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include <iostream>
#include <fstream>
using namespace std;
void heading();
void averagepaid();
int main()
{
  int counter = 0, idno = 0;
  double income = 0.0, tax = 0.0;
  ifstream f1 ("h:\\fall 2014\\irsdata.txt",ios::in);
   heading();
  while (f1>>idno>>income>>tax, !f1.eof())
  {
    counter++;
    cout<< counter<<"  "<<idno<<"  "<<income<<"  "<< tax<<"  ";
    if(income >= 20000 && income <= 30000)
      cout << " in range "<< endl;
    else
      cout << " out of range "<< endl;
   }
   f1.close(); return 0;
  }
  void heading()

  {  cout << " \n\n Assignment # 4  \n";
     cout << " By: Austin Adkison \n"
		  << " Due Date : October 13, 2014 \n\n";
  }
  void averagepaid
  {
      
  }


Within the irsdata.txt is
5647 28500.00 6547.19
9087 21500.00 2975.50
1245 18750.00 2812.50
3421 27500.00 00.00
9700 26250.00 6150.00
2367 23100.00 950.00
2356 21100.00 3975.50
7757 19850.00 3672.90
6656 22500.00 4000.00
2443 20010.00 3012.85
5124 30196.00 5747.24
5994 20575.00 4255.10
3331 24180.00 4170.00
5199 75150.00 26256.00
3995 29995.00 3175.50
8321 6010.00 901.00

I guess what im asking to do, is where to go from here, because the professor doesn't teach what he gives us to do half the time.
Last edited on
It sounds like an interesting homework assignment.

On this forum you will find people eager to answer questions you have about your homework, but we won't do it for you.

Get started on the program, and ask us a question when you get stuck.
I'm well aware of that, and to be honest I'd rather do it myself and get some help anyway or I won't learn anything. But thats the shell program that came with the assignment, but I don't even know where to go next. This is the first time we used fstream and called a text file. I don't know how to use it, for any of the things that he wants.
Actually, he gave you everything you need to read in the file data. Maybe he's waiting until later to explain how it works, but I think you can just take the data that's being input and work with it.

As far as next steps, figure out how you would do it by hand. Figure out what you need to keep track of, and how you would keep track of them.

Next declare some variables and accumulate the data you need. Step through with a debugger (or print stuff out) to make sure you are getting the data you thing you are.

By the way, 1 hint I have for you is to make sure you put curly braces {} around line 17. I suspect you will want to do something else during that check.

After you have accumulated everything you need to keep track of, write the functions you need to process the data, and then write the functions you need to display the data. Take it 1 step at a time.
Topic archived. No new replies allowed.