A person's total income consists of the sum of his/her wages, unemployment compensation and bank interest. A person may file as a single person, or may file jointly as part of a married couple. If filing jointly, the total income is computed based on the total of the couple. The standard deduction to the total income is $5150 for a single person or $10300 for a married couple filing jointly. Additionally, if this person/couple cannot be claimed as dependent(s) on another's tax return, they can deduct an additional $3300(single) / $6600(married). The total income minus any deduction(s) is this person's taxable income. If this value is negative, the taxable income is set to $0.
Input the values in the order specified. Remember to prompt the user for each input with clear instructions. (You may assume all data values entered match the required type, and for numerical data, the values will not be negative.)
HINT FOR READING IN STATUS: Use nextLine() to read in the user's input for married status and dependents. Then use toUpperCase() to convert the input to uppercase and then use charAt(0) to extract out the first character. Then match that character with one of the options.
Example (assuming scan is the variable that references our Scanner):
System.out.println("Input your marital status (S/s, M/m):"); String userInput = scan.nextLine(); char status = userInput.toUpperCase().charAt(0); ... if (status == 'S') ...
WARNING! Do not declare a variable inside of a block. If you do, it will not be accessible outside of the block.
Example (BAD):
if (status == 'S') { int deduction = 5100; } ... income -= deduction; // syntax error: deduction variable is unknown
TAXABLE INCOME TAX FORMULA (compute as an integer) At most $25000 5% of taxable income $25001 - $59999 $1250 + 10% of amount of taxable income above $25000 At least $60000 $4750 + 20% of amount of taxable income above $60000
For example, if a person's taxable income is $40000, then the tax due is $1250 + 10% of the taxable income above $25000 = $1250 + 10% of $15000 = $2750.