/* Tax3.java * Author: Kris og Anne * Translated by: Ida * Exercise 10 to the 4th week * Caculates income tax */ import cs1.Keyboard; public class Tax3 { public static void main(String[] args) { double ambi, pension, localtax, bottomtax, intermediatetax, toptax; System.out.println("Enter your income :"); double income=Keyboard.readDouble(); ambi = income * 0.08; pension = income * 0.01; double income_after_ap = income - (ambi + pension); if (income_after_ap > 33400) { localtax = (income_after_ap-33400)*0.328; bottomtax = (income_after_ap-33400)*0.07; } else { localtax = 0.0; bottomtax = 0.0; } if (income_after_ap > 164300) intermediatetax = (income_after_ap-164300)*0.06; else intermediatetax = 0.0; if (income_after_ap > 267600) toptax = (income_after_ap-267600)*0.15; else toptax = 0.0; System.out.println("Ambi (arbejdsmarkedet bidrag): " + ambi); System.out.println("Pension: " + pension); System.out.println("Local tax: " + localtax); System.out.println("Bottom tax: " + bottomtax); System.out.println("Intermediate tax: " + intermediatetax); System.out.println("Top Tax: " + toptax); System.out.println("In all: " + (ambi+pension+localtax+bottomtax+intermediatetax+toptax)); } }