Last active
April 24, 2017 11:55
-
-
Save dennermiranda/45b63a26b1d3d3f3e7a2963ed3892484 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private def getBalanceAmountR(valAmount: Double, operations: List[Operation]): Double = operations match{ | |
case Nil => valAmount | |
case Purchase(_, value, _, _):: tail => valAmount - getBalanceAmountR(valAmount, tail) | |
case Deposit(_, value, _, _):: tail => valAmount + getBalanceAmountR(valAmount, tail) | |
case Withdrawal(_, value, _, _)::tail => valAmount - getBalanceAmountR(valAmount, tail) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment