Waiting for answer This question has not been answered yet. You can hire a professional tutor to get the answer.

QUESTION

Objectives After completing this lab , you should be able to :

/**

 * description of class TaxForm here.

 *

 * @author (your name)

 * @version (a version number or a date)

 */

import java.util.Scanner;

import java.text.NumberFormat;

import java.util.Locale;

public class TaxForm

{

  private double wages;

  private double taxableInterest;

  private double unempolymentComp;

  private int exemption;

  private double fedIncomeTaxWithheld;

  private double deduction;

  private double AGI;

  private double taxableIncome;

  private double fedTax;

  private double amountDue;

  private double singleTax;

  private double tax;

  private double refund;

  private final double TEN_PCT = 0.10;

  private final double FIFTEEN_PCT = 0.15;

  private final double TWENTYFIVE_PCT= 0.25;

  private final double TWENTYEIGHT_PCT = 0.28;

  public TaxForm()

  {

  }

  /**

   * Constructor for objects of class TaxForm

   */

  public void estimateTaxes() 

  {

    Scanner Sc1 = new Scanner(System.in);

    System.out.println("Your Information");

    System.out.println("Wages, salaries and tips: ");

    wages = Sc1.nextDouble();

    System.out.println("Taxable interest: ");

    taxableInterest = Sc1.nextDouble();

    System.out.println("Unemployment compensation: ");

    unempolymentComp = Sc1.nextDouble();

    System.out.println("Exemptions (0, 1 or 2): ");

    exemption = Sc1.nextInt();

    System.out.println("Federal income tax withheld: ");

    fedIncomeTaxWithheld = Sc1.nextDouble();

    calculateAGI();

    calculateDeduction();

    calculateAmountDue();

    if(exemption == 0 || exemption ==1){

      calculateTaxSingle();

    }else if (exemption == 3){

      calculateTaxJoint();

    }else {

      System.out.print("ERROR: invalid exemption");

    }

    System.out.println("Your Result");

    System.out.println("AGI: " + AGI);

    System.out.println("Taxable income: " + taxableIncome );

    System.out.println("Federal tax: " + tax);

    System.out.println("Amount due: " + amountDue);

  }

  public void calculateAGI(){

    AGI = wages + taxableInterest + unempolymentComp;     

  }

  public void calculateDeduction(){

    switch (exemption){

      case 0:

      deduction = 6350.0;

      break;

      case 1: 

      deduction = 10400.0;

      break;

      case 2: 

      deduction = 20800.0;

      break;

      default:

      System.out.print("ERROR: exemption does not exist");

    }

  }

  public void taxableIncome(){

    double deductedAGI = AGI - deduction;

    if (deductedAGI > 0){

      taxableIncome = deductedAGI;

    } else {

      System.out.print("ERROR: Taxable Income is negative");

    }

  }

  public void calculateTaxSingle(){

    if(taxableIncome > 0 && taxableIncome <= 9325){

      tax = Math.round(TEN_PCT);

    } else if (taxableIncome > 9325 && taxableIncome <= 37950){

      tax = Math.round ( (taxableIncome - 9325) * FIFTEEN_PCT + 932.5);

    } else if (taxableIncome > 37950.0 && taxableIncome <= 91900){

      tax = Math.round ( (taxableIncome - 37950) * TWENTYFIVE_PCT + 5226.25);

    } else if (taxableIncome > 91900){

      tax = Math.round ( ( taxableIncome - 91900) * TWENTYEIGHT_PCT + 18713.75);

    }else {

      System.out.print("ERROR");

    }

  }

  public void calculateAmountDue(){

    if (tax > fedIncomeTaxWithheld){

      amountDue = fedIncomeTaxWithheld - tax;

      refund = 0;

    }else {

      refund = fedIncomeTaxWithheld - tax;

      amountDue = 0;

    }

  }

  public void calculateTaxJoint(){

    if (taxableIncome > 0 && taxableIncome <=18650){

      tax = Math.round(TEN_PCT);

    }else if(taxableIncome > 18650 && taxableIncome <=75900){

      tax = Math.round ( (taxableIncome-18650) * FIFTEEN_PCT + 1865);

    }else if(taxableIncome > 75900){

      tax = Math.round ( (taxableIncome - 75900) * TWENTYFIVE_PCT + 10452.50);

    }else {

      System.out.print("ERROR");

    }

  }

}

  • Attachment 1
  • Attachment 2
  • Attachment 3
  • Attachment 4
  • Attachment 5
  • Attachment 6
ObjectivesAfter completing this lab , you should be able to :*write short problem solutions involving conditional statements*THE MAINREFERENCE to display currency valuesDefinitions`Hager - amount You earned and reported on a W`_ 2 form*Taxable interest - the amount &amp; bank paid you in interestLinemployment Compensation - government payments for unemployment insuranceFederal income far withheld - the amount of tax Your employer withheld from your*paychecksEremotions - the number of people dependent on your income !' if single and yourparents claim you as a dependent , I if you are single , and ? if you are married! .Deduction - amount subtracted from your income before taxes are calculated . &quot;This isbased on the exemptions I'll is 50. 3 50 , I is SId, 400 and ] is $ 20. 800) .Adjusted gross income (^Icy) _ the total at wages , taxable interest and unemploymentTaxable income - ALil minus deductions ( can not be below zero)Tar - amount of tax is based on the taxable income and rates provided in the tax table*depending on filing status ICE _ single or married filing jointly's. Lise Hath_soundil toround to the nearest whole number .Amount owed - if the tax is greater than the tax withheldRefund - if the tax is less than the tax withheldLab Activity # 1 - TaxformImplement a class called Lav Earn that calculates the U.S. federal tax given specific*information . Include proper documentation including method headers to create elegant code*public void estimateTaxes ! ! - Write &amp; method that prompts the taxpayer for*certain information and then displays results including adjusted gross income , taxable*income , federal tax and refund for amount duel . This simplified form is only for*taxpayers Who earned less than Sidd, and and have no dependents . Read user input using*&amp; Bearer .. Use a Number Format object to display' currency' amounts. USE finals for tax rates within the method . For example ,final double FIFTEEN POT = 0. 15:`
Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question