/** * * Write a program that asks the user for their gross income and determines their tax. * * Assume a Simple Tax system. 15% for income above 40000, 10% below. * * */ import java.util.Scanner; import java.text.DecimalFormat; class SimpleTax{ public static void main(String [] args){ final double TAX15 = .15; final double TAX10 = .10; Scanner scanner = new Scanner(System.in); System.out.println("Enter Income\t"); double income = scanner.nextDouble(); if(income < 0){ System.out.println("Invalid Income"); System.exit(1); } double tax; if(income > 40000){ tax = income * TAX15; }else{ tax = income * TAX10; } DecimalFormat fmt = new DecimalFormat("0.00"); System.out.println("The amount of tax you owe is \t$" + fmt.format(tax)); } }