import java.util.Scanner;
public class JaylynnTax {
// Tax rates,constants
final static double TAX1 = 0.10;
final static double TAX2 = 0.15;
final static double TAX3 = 0.33;
final static double BRACKET1 = 15000.00;
final static double BRACKET2 = 45000.00;
final static double BRACKET3 = 60000.00;
public static void main(String[] args) {
/*
Income over $60000 to pay only 10% on first $15000 & 15% on next $45000
& 33% on remaining income IN JAVA.
*/
Scanner keyboard = new Scanner(System.in);
//Variables
double income;
double tax=0;
//Getting income from user
System.out.println("Please input the income, type -1 to end");
income=keyboard.nextDouble();
while(income!=-1) {
if (income<=BRACKET1) {
tax=income*TAX1;
} else if(income<=BRACKET3) {
tax=BRACKET1*TAX1 + (income-BRACKET1)*TAX2;
} else { // income>BRACKET3
tax=BRACKET1*TAX1 + BRACKET2*TAX2 + (income-BRACKET3)*TAX3;
} //end if
System.out.println ("The tax on $" + income + " is $" + tax);
System.out.println("Please input the income, type -1 to end");
income=keyboard.nextDouble();
} // end while
} // end main()
} // end class JaylynnTax
//Variables
double income;
double tax=0;
//Getting income from user
System.out.println("Please input the income, type -1 to end");
income=keyboard.nextDouble();
while(income!=-1){
if (income<=15000)
tax=income*10/100;
System.out.println ("The tax on $" + income + " is $" + tax);
if(income>=15001 && income<=60000){
tax=(income-15000)*20/100 +(15000*10/100);
System.out.println ("The tax on $" + income + " is $" + tax);
}
if (income>60000){
tax=(income-15000)*TAX1+(45000*TAX2)+(income*TAX3);
}
System.out.println("Please input the income, type -1 to end");
income=keyboard.nextDouble();