The following exercise will assess your ability to deliver well structured and maintainable code. As a TDD shop we will put equal emphasis on evaluating your tests as we will on the code itself. The exercise should only take 30 40 minutes; don’t spend much longer than this. Please complete the following exercise in Scala. If this exercise goes well, you may be asked to make further amendments to your code during a pair programming exercise with a member of the team. Please use git to version control your exercise. After completing the first step, please clearly tag the commit so that we can evaluate your approach. You may make other commits to further demonstrate your approach. Please compress your answers and submit them via your agent or send us a link to your Github (or similar) account. Do not send us binaries, they won’t get through our firewalls.
Complete the steps in order. Don’t read ahead. At each step build the simplest possible solution which meets our requirement. Tag a git commit after each step so that your approach is clear.
Your answers will be used as part of our sifting and are likely to be discussed with your interviewer at later stages.
- You are building a checkout system for a shop which only sells apples and oranges.
- Apples cost 60p and oranges cost 25p.
- Build a checkout system which takes a list of items scanned at the till and outputs the total cost
- For example: [ Apple, Apple, Orange, Apple ] => £2.05
- Make reasonable assumptions about the inputs to your solution; for example, many candidates take a list of strings as input
- The shop decides to introduce two new offers
- buy one, get one free on Apples
- 3 for the price of 2 on Oranges
- Update your checkout functions accordingly