Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that will compute and print the federal taxes for several person

ID: 3634359 • Letter: W

Question

Write a program that will compute and print the federal taxes for several persons and collect and print the totals for these people.
Example input:
Name Jim D Smith
Number of exemptions 3
Income:
Wages, salaries, tips 50000
Ordinary dividends 200
Taxable refunds 215
Capital gains 300
Adjustments to income:
IRA deduction 2000
Tuition and fees 1000
Itemizing deductions:
State and local income taxes 500
Real-estate taxes 4000
Home Mortgage interest 5000
Charitable giving 1000
Federal tax withheld 3000
The calculations will be as follows:
1) The four types of income are added
2) The adjustments to income are subtracted from income giving the adjusted gross income.
3) The four itemized deductions are added and this value is subtracted from the adjusted gross income.
4) Multiply the number of exemptions times $3,650 and subtract this number from the adjusted gross income. This gives the taxable income.
5) The tax rates are as follows
0 through 30,000 is 10%
30,000 through 60,000 is 20%
60,000 through 120,000 is 30%
Over 120,000 is 35%
6) Subtract the value of the taxes owed from the Federal taxes withheld, if the difference is greater than 0 that is the amount of the refund. If this number is less than 0 then this is the amount which still must be paid.
Using the above data, typical outputs for one person will look like: (this is computed accurately with the above data)
Tax payer: Jim D Smith
Income 50715
Adjustments to income 3000
Itemized deductions 10500
Taxable income 26265
Federal tax 2626.5
You have a refund of 373.5
Output for the collected data will look like this: // (these are not correct data)
TAXPAYER REPORT::
Number of people 3
Total Income: 200456
Total Taxable income 159678
Total Federal Tax 50567
This project will have at least three classes. Create a taxpayer class that will have methods and data related to a single taxpayer

Create a second class called FederalTotals which will keep track of the totals for the number of taxpayers


Following is the demo class that you must use to run your program.
import java.io.*;
public class TaxDemo
{
public static void main(String[] args)
{
Scanner scan = new Scanner(System.in);
FederalTotals clerk = new FederalTotals ( );
TaxPayer person = new TaxPayer ();// one TaxPayer
int numberOfTaxPayers, I;
System.out.println("Enter number of tax payers:");
numberOfTaxPayers = scan.nextInt( );
for(i = 0; i < numberOfTaxPayers; i++)
{
person.readInput();
person.calculateData();
person.writeOutput();
clerk.colectDataForReport(person);
}
clerk.printDataForSchoolReport();
}
}

Explanation / Answer

TaxPayer.java

import java.util.Scanner;


class TaxPayer
{

private String name;
private int exemptions;
//income
private double salary;
private double dividend;
private double Taxablerefunds;
private double Capitalgain;
//Adjustments to income
private double IRAdeduction;
private double Tuitionfees;
//Itemizing deductions
private double Statelocalincometax;
private double Realestatetax;
private double HomeMortgageinteret;
private double Charitablegiving;

private double Federaltaxwithheld;

double totalincome;
double adjustment;
double itemizing;
double federaltax;
double taxableincome;
public void readInput()
{
Scanner sc=new Scanner(System.in);
System.out.println("Enter name");
name=sc.next();
System.out.println("Enter number of exemptions");
exemptions=sc.nextInt();
System.out.println("Salary");
salary=sc.nextDouble();
System.out.println("Dividend");
dividend=sc.nextDouble();
System.out.println("Taxable Refunds");
Taxablerefunds=sc.nextDouble();
System.out.println("Capitalgain");
Capitalgain=sc.nextDouble();

System.out.println("Adjustments to income");
System.out.println("IRA deduction");
IRAdeduction=sc.nextDouble();
System.out.println("Tuitionfees");
Tuitionfees=sc.nextDouble();

System.out.println("Itemizing deductions");
System.out.println("Statelocalincometax");
Statelocalincometax=sc.nextDouble();
System.out.println("Realestatetax");
Realestatetax=sc.nextDouble();
System.out.println("HomeMortgageinteret");
HomeMortgageinteret=sc.nextDouble();
System.out.println("Charitablegiving");
Charitablegiving=sc.nextDouble();;
System.out.println("Federaltaxwithheld");
Federaltaxwithheld=sc.nextDouble();
}
public void calculateData()
{
totalincome=salary+dividend+Taxablerefunds+Capitalgain;
adjustment=IRAdeduction+Tuitionfees;
itemizing=Statelocalincometax+Realestatetax+HomeMortgageinteret+Charitablegiving;
taxableincome=(totalincome-adjustment)-itemizing-(exemptions*3650);
if(taxableincome>=0&&taxableincome<30000)
{
federaltax=(taxableincome*10)/100;
}
else if(taxableincome>=30000&&taxableincome<60000)
{
federaltax=(taxableincome*20)/100;
}
else if(taxableincome>=60000&&taxableincome<120000)
{
federaltax=(taxableincome*30)/100;
}
else if(taxableincome>=120000)
{
federaltax=(taxableincome*35)/100;
}
}
public void writeOutput()
{
System.out.println("Tax payer:"+name);
System.out.println("Income -"+totalincome);
System.out.println("Adjustments to income -"+adjustment);
System.out.println("Itemized deductions"+itemizing);
System.out.println("Taxable income -"+taxableincome);
System.out.println("Federal tax -"+federaltax);
if(federaltax<Federaltaxwithheld)
System.out.println("You have a refund of -"+(Federaltaxwithheld-federaltax));
else
System.out.println("Federal Tax To be paid -"+(federaltax-Federaltaxwithheld));
}
}

FederalTotals.java


class FederalTotals
{
TaxPayer[] p;
static int a=0;
public void colectDataForReport(TaxPayer person)
{
p[a]=person;
a++;
}
public void printDataForSchoolReport()
{
System.out.println("TAXPAYER REPORT::");
System.out.println("Number of people-"+(++a));
double totalincome=0;
double totaltaxableincome=0;
double totalfederaltax=0;
for(int i=0;i<a;i++)
{
totalincome+=p[i].totalincome;
totaltaxableincome+=p[i].taxableincome;
totalfederaltax=p[i].federaltax;
}
System.out.println("Total Income:"+totalincome);
System.out.println("Total Taxable income"+totaltaxableincome);
System.out.println("Total Federal Tax"+totalfederaltax);
}


}

Main.java


import java.io.*;
import java.util.Scanner;
public class Main {


public static void main(String[] args)

{

Scanner scan = new Scanner(System.in);
FederalTotals clerk = new FederalTotals( );
TaxPayer person = new TaxPayer ();// one TaxPayer

int numberOfTaxPayers,i;

System.out.println("Enter number of tax payers:");

numberOfTaxPayers = scan.nextInt( );

for(i = 0; i < numberOfTaxPayers; i++)

{

person.readInput();
person.calculateData();
person.writeOutput();
clerk.colectDataForReport(person);

}
clerk.printDataForSchoolReport();

}
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote