Comment on page

Recruitment challenge #2

Welcome, algorithm champion ! Find here the challenge to prove your worth to Seraphin's Team

🎯 Objectives & Mindset

This challenge aims at making sure that we've got a clear understanding of your current technical coding level and abstraction with algorithm. No need to be an expert, the important is that you do your best so we can transparently assess whether you're technically a good fit for the job.
There is no perfect answer to the challenge, and we'll be pleased to hear how and why you came to the solution you propose. There are however wrong answers (the ones that do not meet the specifications), so we'll assume it's a sign of laziness from you to submit an answer which is factually not correct (unless the specifications were provably unclear). Please don't be that person 😉.
We invite you to take enough time to provide a well-crafted solution, learning new things along the way. We love structure, clear code, well commented source files, green tests, explicitly named variable and function names, simple architectures...Do consult best practices online, do look for other solutions to similar problems. It would be really cool if you could also surprise us with things you teach us that we did not know!
This challenge is only the technical part, remember that for us the human part is also extremely important - but that is something to be discussed face-to-face afterwards.
Good luck, algorithm champion!

🏆 The Challenge

Your mission is to code a little program that will compute the correct driver's bonus-malus score for given inputs. In Belgium, the bonus-malus is a system used by the insurance companies to adapt the premium price for their car insurance policy, depending on the amount of the driver's driving years and the amount of accidents at fault that occurred during the last five years.
How does it work ? Good drivers who don't have accidents have their bonus-malus decreased year after year. On the other hand, drivers who have accidents (at fault) have their bonus-malus increased. The bonus-malus ranges from -2 (best) up to 22 (worst). The first year you start driving, it is set at 11. For each accident at fault, it is increased by 5.
You can see this in action in the table below, which is the bonus-malus scheme of one of our insurer partners. If you look carefully, you will notice that after a certain amount of driving years, the driver is eligible for a reduced penalty in case he has 1 claim at fault. You will also notice that there is a distinction between private and professional drivers.

🚧 Specifications

We are waiting from you to create a little program that will return the correct bonus-malus score according to the table above, when given the following inputs :
  1. 1.
    Amount of driving years
  2. 2.
    Amount of accidents at fault (0, 1 or 2)
  3. 3.
    Usage (private or professional)
For example, if we give as inputs that a driver has 10 driving years, 1 accident at fault (during the last 5 years) and is a private driver, we would like to receive as output that his bonus-malus score is 6.
Practically speaking, you are completely free regarding how you put this together. You can use any language you like, present this through a command-line or a graphical interface, as an API,... All we want to see is a well-crafted solution, respecting the following specifications :
  • The correct bonus-malus score should obviously be returned according to the given inputs
  • Automated testing is required (unit and integration tests)
  • A well crafted solution with inspiration from the best practices. You are a craftsman, performing a nice piece of work, so act accordingly 😉
  • Documentation about how your app works, from a user point of view as well as from a technical one

🗓️ Practicalities

Please publish your code to a public GitHub repository and send us the link. We expect to find in this repo the instructions regarding how to start & use your app.
Now, let's get started. All the best! 🚀