Banking Kata - Scala Developers Barcelona
Some weeks ago I co-organized a Scala BCN meetup where we implemented a Bank account class in pairs and TDD. Easy for any of you that are starting with Scala. Here you have the github link to try it by yourself!
Copy from the README.md
This kata will take place on Nov. 23, 2017. It is an adapted version of the banking kata from http://kata-log.rocks/
To start, download/clone the repository and import the project with IntelliJ. You can also use plain old vim
and sbt
. Enjoy!
Copy of the (almost) original explanation:
Your Task
Your bank is tired of its mainframe COBOL accounting software and they hired both of you for a greenfield project in - what a happy coincidence
your favorite programming language!
Your task is to show them that your TDD-fu and your new-age programming language can cope with good ole’ COBOL!
Requirements
Write a class Account
that offers the following methods void deposit(double)
double withdraw(double)
void printStatements()
and double balance
An example statement would be:
Date Amount Balance
24.12.2015 +500 500
23.8.2016 -100 400
Solutions
There are two solutions available. One is more java-like and the other one is more functional (thanks to Lau and Artur for this solution).
https://unsplash.com/@caminouflet?utm_source=ghost&utm_medium=referral&utm_campaign=api-credit