This is a type of technical test I received from a well-reputed company for an interview. Hopefully, this will help for learning purposes.
This test is a programming exercise to evaluate the candidate's technical skills and approach to software development. The candidate is expected to produce a solution in code that demonstrates they understand how to solve the problem using clear concise code.
You are required to model the following fare card system which is a limited version of London’s Oyster card system. At the end of the test, you should be able to demonstrate a user loading a card with £30, and taking the following trips, and then viewing the balance.
- Tube Holborn to Earl’s Court
- 328 bus from Earl’s Court to Chelsea
- Tube Earl’s court to Hammersmith
When the user passes through the inward barrier at the station, their oyster card is charged the maximum fare.
When they pass out of the barrier at the exit station, the fare is calculated and the maximum fare transaction removed and replaced with the real transaction (in this way, if the user doesn’t swipe out, they are charged the maximum fare).
All bus journeys are charged at the same price.
The system should favour the customer where more than one fare is possible for a given journey. E.g. Holburn to Earl’s Court is charged at £2.50.
For the purposes of this test use the following data:
Station | Zone(s) |
---|---|
Holborn | 1 |
Earl’s Court | 1, 2 |
Wimbledon | 3 |
Hammersmith | 2 |
Journey | Fare |
---|---|
Anywhere in Zone 1 | £2 |
Any one zone outside zone 1 | £2 |
Any two zones including zone 1 | £3 |
Any two zones excluding zone 1 | £2 |
Any three zones | £3 |
Any bus journey | £1 |
The maximum possible fare is therefore | £3.20 |
Points you will be assessed on:
- Following the Operational requirements
- A working solution which meets the requirements.
- Testing methods and coverage
- Design, Approach and Elegance of Solution.