Question: The question is asking to finish the code and output the income tax for any given input. Any input that is either a non-number or

The question is asking to finish the code and output the income tax for any given input.

Any input that is either a non-number or a negative number must result in "Invalid Input"The question is asking to finish the code and output the income

Below is what I currently have.

import java.util.Scanner; /** Class TaxReturn is used to determine the tax amount for a person. The original U.S. income tax table of 1913 is applied. */ /** * Code for E5.18 * @ Author Henry Comstock */ public class Main { private static final double RATE1 = 0.06; private static final double RATE2 = 0.05; private static final double RATE3 = 0.04; private static final double RATE4 = 0.03; private static final double RATE5 = 0.02; private static final double RATE6 = 0.01;

private static final double BRACKET1 = 500000; private static final double BRACKET2 = 250000; private static final double BRACKET3 = 100000; private static final double BRACKET4 = 75000; private static final double BRACKET5 = 50000;

private double income;

/** Constructs a TaxReturn object for a given income. @param anIncome the taxpayer income */ public Main(double anIncome) { income = anIncome; }

/* Method used to calculate the tax. @return the tax amount */ public double getTax() { double tax = 0;

// Your work starts here. Do not change the codes above. private static void main(String[] args){

double tax1 = 0.0; // tax1 computes the tax at RATE1 double tax2 = 0.0; // tax2 computes the tax at RATE2 double tax3 = 0.0; // tax3 computes the tax at RATE3 double tax4 = 0.0; double tax5 = 0.0; double tax6 = 0.0;

double Income = 0; String inputStr; double income = 0; double singleIncome;

// Scanner class object Scanner in = new Scanner(System.in);

//calculating your income using try/catch System.out.print("Enter your income: "); inputStr = in.next(); try { Income = Double.parseDouble(inputStr); } catch (NumberFormatException e) { System.out.print("Invalid self income Input, not a number"); } if (Income BRACKET5 && Income BRACKET5 && Income BRACKET3) { tax1 = RATE6 * BRACKET5; tax2 = RATE5 * (Income - BRACKET1); tax3 = RATE4 * (Income - BRACKET2); } else if (Income > BRACKET5 && Income BRACKET3 && Income > BRACKET2) { tax1 = RATE6 * BRACKET5; tax2 = RATE5 * (Income - BRACKET5); tax3 = RATE4 * (Income - BRACKET4); tax4 = RATE3 * (Income - BRACKET3); } else if (Income > BRACKET5 && Income BRACKET3 && Income > BRACKET2 && Income > BRACKET1) { tax1 = RATE6 * BRACKET5; tax2 = RATE5 * (Income - BRACKET5); tax3 = RATE4 * (Income - BRACKET4); tax4 = RATE3 * (Income - BRACKET3); tax5 = RATE2 * (Income - BRACKET2); } else { tax1 = RATE6 * BRACKET5; tax2 = RATE5 * (Income - BRACKET5); tax3 = RATE4 * (Income - BRACKET4); tax4 = RATE3 * (Income - BRACKET3); tax5 = RATE2 * (Income - BRACKET2); tax6 = RATE6 * (Income - BRACKET1); }

double totalTax = (tax1 + tax2 + tax3 + tax4 + tax5 + tax6);// finding total tax //finding total income if (totalTax

// Printing result System.out.print(totalTax); // Your work ends here. Do not change the codes below.

return tax; } }

1. ES. 18 The original U.S. income tax of 1913 was quite simple. The tax was . I percent on the first $50,000. 2 percent on the amount over $50.000 up to $75,000. 3 percent on the round over $75,000 up to $100,000. 4 percent on the moun over $100,000 up to $250.000 5 percent on the account over $250,000 up to $500.000, 6 percent on the count over $500,000 There was no separate schicdule for single or inamied taxpayers. Write a prograin that computes the income tax according to this schedule

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!