package com.blocksolid.income;

/**
 * Created by Dan Buckland on 16/09/2015.
 */

public class TaxCalculator {

    int MAX_PERSONAL_ALLOWANCE = 1060000;           // £10,600
    int PERSONAL_ALLOWANCE_THRESHOLD = 10000000;    // £100,000
    int BASIC_RATE_THRESHOLD = 3178500;             // £31,785
    int HIGHER_RATE_THRESHOLD = 15000000;           // £150,000

    int annualIncome;
    int personalAllowance;

    public TaxCalculator(int annualIncome) {
        this.annualIncome = annualIncome;
        calculatePersonalAllowance();
        //calculateDeductions(personalAllowance);
    }

    public void setAnnualIncome(int newAnnualIncome) {
        annualIncome = newAnnualIncome;
    }

    public int getAnnualIncome() {
        return annualIncome;
    }

    public int calculatePersonalAllowance() {
        // TODO calculate the personal allowance that's needed to calculate tax deductions
        return personalAllowance;
    }

}
@@ -824,29 +824,245 @@
     
-// TODO calculate the
+if (annualIncome %3E PERSONAL_ALLOWANCE_THRESHOLD) %7B%0A            int difference = annualIncome - PERSONAL_ALLOWANCE_THRESHOLD;%0A            if (difference %25 200 %3E 0) %7B%0A                difference = difference - 100;%0A            %7D%0A           
  per
@@ -1066,18 +1066,17 @@
 personal
- a
+A
 llowance
@@ -1080,49 +1080,229 @@
 nce 
-that's needed to calculate tax deductions
+= MAX_PERSONAL_ALLOWANCE - (difference / 2);%0A            if (personalAllowance %3C 0) %7B%0A                personalAllowance = 0;%0A            %7D%0A        %7D else %7B%0A            personalAllowance = MAX_PERSONAL_ALLOWANCE;%0A        %7D
 %0A   

Add calculatePersonalAllowance method to pass unit tests