package Hypotheek; import static Hypotheek.Util.* ; public class Netto { static int BRUTO_MAX = euro2cent(21000000) ; static int AGE_MAX = 200 ; /** * Bruto annual salary. */ int bruto ; int age ; InkomenBelasting taxsystem = new InkomenBelasting2009() ; class Result { int inkomenbelasting ; int premie_volksverz ; int bijdr_zorgver ; int arbeidskorting ; int netto ; } /** * Calculate the annual netto income based on the bruto income * of this object. */ public Result calc() { Result R = new Result() ; R.inkomenbelasting = taxsystem.calcInkomenBelasting(bruto, age) ; R.premie_volksverz = taxsystem.caclPremieVolksverzekeringen(bruto, age) ; R.bijdr_zorgver = taxsystem.calcBijdrageZorgverzekering(bruto, age) ; R.arbeidskorting = taxsystem.calcArbeidskorting(bruto, age) ; R.netto = bruto - R.inkomenbelasting - R.premie_volksverz - R.bijdr_zorgver ; assert R.netto >= 0 ; return R ; } public String printResult(Result R) { StringBuffer o = new StringBuffer() ; int W = 31 ; o.append(" GEGEVENS:\n") ; o.append(leftAlign(" Bruto jaarinkomen = ",W) + showEuro(bruto,12) + " eur.\n") ; o.append(leftAlign(" Leeftijd = ",W) + rightAlign("" + age,9) + " jaar\n") ; o.append(" RESULTAAT:\n") ; o.append(leftAlign(" Inkomenbelasting = ",W) + showEuro(R.inkomenbelasting,12) + " eur.\n") ; o.append(leftAlign(" Vereken arbeidskorting = ",W) + showEuro(R.arbeidskorting,12) + " eur.\n") ; o.append(leftAlign(" Premie volksverzekeringen = ",W) + showEuro(R.premie_volksverz,12) + " eur.\n") ; o.append(leftAlign(" Bijdrage zorgverzekering = ",W) + showEuro(R.bijdr_zorgver,12) + " eur.\n") ; o.append(leftAlign(" NETTO = ",W) + showEuro(R.netto,12) + " eur.\n") ; return o.toString() ; } static public void main(String[] agrs) { Netto N = new Netto() ; N.bruto = euro2cent(30000) ; N.age = 30 ; Result R = N.calc() ; System.out.print(N.printResult(R)) ; } }