Android Open Source - DisposableIncome-OldJava Withdrawal For Month Calculator






From Project

Back to project page DisposableIncome-OldJava.

License

The source code is released under:

MIT License

If you think the Android project DisposableIncome-OldJava listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package uk.co.wilka.disposableincome;
/*w ww  . j a v a2  s .  c  o  m*/
import java.util.ArrayList;

public class WithdrawalForMonthCalculator {
    private Cash totalActual;
    private Cash totalPredicted;

    // TODO: Unit test for this
    public WithdrawalForMonthCalculator(WithdrawDateComparer dateComparer, ArrayList<CashWithdraw> withdraws) {
        totalActual = Cash.fromPence(0);
        totalPredicted = Cash.fromPence(0);

        for (CashWithdraw withdraw : withdraws) {

            if(dateComparer.isThisMonth(withdraw)) {
                if(withdraw.getWithdrawType() == WithdrawType.Actual) {
                    totalActual = totalActual.plus(withdraw.getAmount());
                }
                if(withdraw.getWithdrawType() == WithdrawType.Predicted) {
                    totalPredicted = totalPredicted.plus(withdraw.getAmount());
                }
            }
        }
    }

    public Cash getTotalActual() {
        return totalActual;
    }

    public Cash getTotalPredicted() {
        return totalPredicted;
    }
}




Java Source Code List

uk.co.wilka.disposableincome.CalendarAccess.java
uk.co.wilka.disposableincome.CalendarProvider.java
uk.co.wilka.disposableincome.CashWithdraw.java
uk.co.wilka.disposableincome.CashWithdrawalDetailsActivity.java
uk.co.wilka.disposableincome.Cash.java
uk.co.wilka.disposableincome.DatabaseHelper.java
uk.co.wilka.disposableincome.IAccessData.java
uk.co.wilka.disposableincome.IProvideCalendar.java
uk.co.wilka.disposableincome.MainActivity.java
uk.co.wilka.disposableincome.PlusOneMonthCalendarProvider.java
uk.co.wilka.disposableincome.WithdrawDateComparer.java
uk.co.wilka.disposableincome.WithdrawType.java
uk.co.wilka.disposableincome.WithdrawalForMonthCalculator.java
uk.co.wilka.disposableincome.test.CashTest.java
uk.co.wilka.disposableincome.test.CashWithdrawTest.java
uk.co.wilka.disposableincome.test.FakeCalendarProvider.java
uk.co.wilka.disposableincome.test.PlusOneMonthCalendarProviderTests.java
uk.co.wilka.disposableincome.test.WithdrawDateComparerTests.java
uk.co.wilka.disposableincome.test.WithdrawalForMonthCalculatorTests.java