# Thread: Problem working out Assignment

1. Member
Join Date
Nov 2010
Posts
90
Rep Power
0

## Problem working out Assignment

Hi guys, not really a java problem.. but i'm stuck and wondering if i can get some help.

im 1/3 way through my assignment and the next criteria is as follows

The program must allow the user to enter the following information:

**Your program should prompt the user to enter a number (with or without decimals) via the keyboard and then proceed to calculate the stamp duty payable. The result should then be displayed to the user in an easy to read format.
**The stamp duty brackets you will need to use are listed below.

Purchase Amount Percentage
< \$20,000 1.4% of dutiable value
\$20,001 - \$115,000 + 2.4% of dutiable value (added to the previous amount)
\$115,001 - \$870,000 + 6% of dutiable value (added to the previous amount)
> \$870,000 5.5% of dutiable value
My problem is i don't understand this Stamp duty. i've look around on the net and all i find is Calculators..

Does anyone know how to work out stamp duty?
according to one website.. \$300,000 value by these vigures should be about \$13,000 stamp duty but i still cant figure it out..
i thought it would be 300,000 / 6% + (whatever previous amount is).. what is this previous amount?

if you can help it would be great

thanks

2. This is nothing more than some if blocks and simple arithmetic. Can you work out how you'd calculate this on paper? If so, then try to translate this code into Java. If you're still stuck, post in pseudo-code what you think the logical steps should be.

3. Member
Join Date
Nov 2010
Posts
90
Rep Power
0
thanks.

i know it's in if statments but it's the working out of Stamp duty im having trouble with. like the math for it

im thinking if the value was \$110,000
20k would be processed at 1.4 % and the rest would be processed at 2.4% + the duty from the 20k

4. OK, say you enter \$30,000, then

First \$20,000 is processed at 1.4% rate, 20,000 * 0.014 = 280

Then the rest, \$30,000 - \$20,000 (in other words, \$10,000) is processed at the 2.4% rate, \$10,000 * 0.024 = 240

So the total tax would be 280 + 240 = \$520

5. Member
Join Date
Nov 2010
Posts
90
Rep Power
0
so is it oly the previous one..
if it was 140,000
would 20 get 1.4
115 get 2.4 and rest at 6% ?
or 115 at 2.4% and rest at 6%

6. If it was 140, then:
20 taxed at 1.4% rate
115 - 20 (95) taxed at 2.4% rate
140 - 115 (25) taxed at 6% rate

Then add up all the taxes

7. Member
Join Date
Nov 2010
Posts
90
Rep Power
0
thanks heaps :)
i got it now
i can move on to the fianl piece of my assignment yay

8. Great. And good luck. Note that if you live in the USA, you'd better understand this tax system well as it is similar to how the USA calculates individual federal income tax.

9. Member
Join Date
Nov 2010
Posts
90
Rep Power
0
im all Australian here :)

10. Originally Posted by maknib
im all Australian here :)
Per Wikipedia, Australia also uses a similar progressive tax on personal income, so this knowledge will come in handy, even for those living down under. Cheers!

11. ## Hi

What I would do is create an Enum class for the tax percentages so that they can be easily changed without looking at your main code and then read the tax percent from those. I've written something for you as an example but I havent tested if it works or not:

Java Code:
```public enum TaxRates {

TAX_RATE_1(0,1.4),
TAX_RATE_2(20001,2.4),
TAX_RATE_3(115001,6),
TAX_RATE_4(870000,5.5);

public double minBound;

public TaxRates(double minBound, double addedTaxPercent) {
this.minBound = minBound;
}

}

class CalculateTax {

public double getTax(double purchaseAmount) {
double totalTax = 0;
for (TaxRates t:TaxRates.values()) {
taxableAmount = purchaseAmount - t.minBound;
totalTax += taxAmount;
}
}

public static main(String args[]) {
if (args.length > 1) {
System.out.println("Usage: java CalculateTax [number] e.g. java CalculateTax 100000");
System.exit(0);
} else {
double inputAmount = Double.parseDouble(args[0]);
double tax = getTax(inputAmount);
System.out.printf("The tax amount on AU\$%.2f is AU\$%.2f",inputAmount,tax);
}
}

}```
Last edited by ozzyman; 03-14-2011 at 10:47 PM.

12. Member
Join Date
Nov 2010
Posts
90
Rep Power
0
Thanks but as i said we are in Week 2 of Java. just covering If statements and switches.. i have no idea what an ENUM class is yet :P

13. Ah, I see. Well good luck.

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•