sashafierce wrote: » This post has been deleted.
jaysond wrote: » I've included code below for calculating the tax. I put a few test cases through it and it 'seems' ok but don't start flaming me if any parts of it are wrong. If they are wrong, you should be able to fix them yourself. If not, simply give up. I agree with the comments of all the above authors especially the 'handing out answers on a plate' one. I know I've just done it (not fully tested!!), but I've had numerous bad experiences in the past of working with 'programmers' who constantly expected to be spoon fed solutions. They are time consuming leeches and are f**k all use around deadline time (or any time for that matter). Do yourself a favour and start solving problems yourself or at least make a serious effort doing so before you approach someone for the solution. Your gonna have to learn (or get use to) persevering with the problem and just as importantly, make sure that you understand the problem. In your example, variables were not declared in your listing, syntax was incorrect which would have generated numerous errors when compiled. These are very basic programming items and people really don't want to be wasting their time with this kind of stuff. Anyways, have fun and for your own sake, RTFM and if you don't understand it the first time, do it again and again until you do. Persevere and make sure you understand!! In the code below, your also gonna have to put in some code for reading from the keyboard and initialise the respective variables. Enjoy! [PHP] import java.util.*; public class TaxAssignment { public static void main(String[] args) { char cAccountType; double dLowerTaxBand = 0.0, dUpperTaxBand = 0.0; double dLowerTaxRate, dUpperTaxRate; double dSalary; cAccountType = 'A'; // catagory of tax payer dSalary = 50000; // salary per year dLowerTaxRate = 28.0 / 100.0; // tax rates same for all cases. dUpperTaxRate = 45.0 / 100.0; if(cAccountType == 'A' || cAccountType == 'a') // Single person { dLowerTaxBand = 10000; dUpperTaxBand = 28000; } else if(cAccountType == 'B' || cAccountType == 'b') // married single sal { dLowerTaxBand = 12000; dUpperTaxBand = 29000; } else if(cAccountType == 'C' || cAccountType == 'c') // married two salary { dLowerTaxBand = 20000; dUpperTaxBand = 50000; } double dStandardTaxRange = dUpperTaxBand - dLowerTaxBand; double dTaxableSalary = dSalary - dLowerTaxBand; double dTaxDue = 0.0; if(dTaxableSalary > 0.0) { if(dTaxableSalary > dStandardTaxRange) dTaxDue = dStandardTaxRange * dLowerTaxRate; else dTaxDue = dTaxableSalary * dLowerTaxRate; dTaxableSalary -= dUpperTaxBand; if(dTaxableSalary > 0.0) dTaxDue += dTaxableSalary * dUpperTaxRate; } System.out.println("Tax due: " + dTaxDue); } } [/php]
tax = (income-(10000*0.00)-(15000*0.28))*0.45;
cAccountType == 'C' || cAccountType == 'c'