package tricassign4; import SavitchIn; /* @author Christopher Tricarico *email: mr.freeze12#@angelfire.com */ public class Tricassign4 { public static final double TAXRATE1 = .15 ,TAXRATE2 = .27,TAXRATE3 = .30,INCOME1 = 25000,INCOME2 = 35000; public Tricassign4() { } public static void main (String args[]) { System.out.println("Please input your Income: "); double firsttax,firstbreak,secondtax,secondbreak,thirdtax,totaltax; /* these variable are equal to the following throughout the program firsttax = 15% of the income secondtax = 27% of the remaining income thirdtax = 30% of the remaining income after top two are done firstbreak = remaining income after 25,000 is subtracted secondbreak = remaining income after 25,000 and 35,000 are subtracted*/ double income; income = SavitchIn.readLineDouble(); if (income >= INCOME1){ /* finds if the income is above or equal to 25000 and takes 15% of it*/ firsttax=INCOME1*TAXRATE1; firstbreak=income-INCOME1; } else { /* finds if the income is below 25000 and takes 15% of it*/ firsttax=income*TAXRATE1; firstbreak=0; } if (firstbreak >= INCOME2) { /* finds if the remaining income is above or equal to 35000 and takes 27% of it*/ secondtax=INCOME2*TAXRATE2; secondbreak=firstbreak-INCOME2; } else { /* finds if the remaining income is below 35000 and takes 27% of it*/ secondtax=firstbreak*TAXRATE2; thirdtax=0; secondbreak=firstbreak-INCOME2; } if (secondbreak > 0) { /* takes the remaining income and finds 30% of it*/ thirdtax=secondbreak*TAXRATE3; } else { thirdtax = 0; } totaltax= firsttax + secondtax + thirdtax; /* totaltax = firsttax + secondtax + thirdtax (as defined above)*/ System.out.println("Tax Results"); System.out.println(" Income: " + income); System.out.println(" Taxdue: " + totaltax); } }