|
help with an exercise calcuting tax
i was hoping to get some help on an exercise that we have been given that asks to calculate tax. i am an absolute novice and any help would be appreciated.
we're asked to calculate tax for the 2007 period on a given income and the percentage of the income the tax represents. income less than $38000 is taxed at 19.5%, from $38000 to $60000 at 33% and over $60000 at 39%. However, earned income less than $9500 is given a rebate of 4.5% but this rebate is reduced by 1.5% of income between $9,500 and $38,000.
Additionally there is the repayment of a student loan. Although called a “loan” it is not an ordinary loan as it doesn’t ever have to be repaid, rather an agreement to pay additional tax of 10% on income over $17,160 until you have met your obligation.
Your program should show the tax both with and without a student loan in exactly the format of the following example:
Type in total income to nearest dollar: 35500
On an income of: $35500
Income tax is: $6923
With rebate of: $38
Giving total tax of: $6885
Which is: 19% of income
With a student loan:
Loan repayment is an additional: $1834
For total "tax" of: $8719
Which is: 25% of income
Press any key to continue . . .
we are given some variables such as:
final double LOW_TAX_RATE = 0.195;
final double MID_TAX_RATE = 0.33;
final double TOP_TAX_RATE = 0.39;
final double REBATE_RATE = 0.045;
final double PENALTY_RATE = 0.015;
final double LOAN_RATE = 0.1;
This kind of program will be easier to write when we have gone further and learned about conditional statements. For now you must write this program without using any conditional statements at all. Rather, you need to make use of the methods Math.max() and Math.min().
For example, the amount of income less than $38000 may be calculated as:
Math.min(income,38000)
the amount of income over $60000 may be calculated as:
Math.max(0,income-60000)
Note that the amount of income between, say, $38,000 and $60,000 is the amount of income less than $60,000 that is greater than $38,000.
The detailed instructions ask that you do arithmetic with double variables and values but print out the answers to the nearest dollar. Use the method Math.round()to convert a double value to the nearest whole dollar value.
we havent as yet covered if and else statements and are only up to strings
|