Results 1 to 13 of 13
Thread: Problem working out Assignment
 03132011, 12:38 PM #1Member
 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
Menu execution:
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
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

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 pseudocode what you think the logical steps should be.
 03132011, 01:13 PM #3Member
 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

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
 03132011, 01:23 PM #5Member
 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%

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
 03132011, 02:12 PM #7Member
 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

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.
 03132011, 02:28 PM #9Member
 Join Date
 Nov 2010
 Posts
 90
 Rep Power
 0
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!

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 double addedTaxPercent; public TaxRates(double minBound, double addedTaxPercent) { this.minBound = minBound; this.addedTaxPercent = addedTaxPercent; } } class CalculateTax { public double getTax(double purchaseAmount) { double totalTax = 0; for (TaxRates t:TaxRates.values()) { taxableAmount = purchaseAmount  t.minBound; taxAmount = taxableAmount*(t.addedTaxPercent/100); totalTax += taxAmount; } return totalTax; } 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; 03142011 at 10:47 PM.
 03142011, 04:04 AM #12Member
 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

Similar Threads

problem with java assignment
By jaire in forum New To JavaReplies: 9Last Post: 03102011, 12:00 PM 
Problem with my assignment  in need of help!
By Chopaan in forum New To JavaReplies: 1Last Post: 01172011, 03:19 AM 
assignment problem with List<T>
By Newbie666 in forum New To JavaReplies: 11Last Post: 01212010, 01:12 PM 
The Assignment Problem
By bumblyb33 in forum New To JavaReplies: 5Last Post: 03042009, 05:21 AM 
Java mail problem(working in intranet,but not working in iternet)
By sundarjothi in forum Advanced JavaReplies: 8Last Post: 05282008, 07:00 AM
Bookmarks