This was a coding challenge as a part of the Intuit Coding Challenge, it had to be solved in Java. Although I have very basic experience of Java, here's my solution. The logic was able to produce correct results but it didnot pass the other parameters. Therefore I didnot get selected for the next round. But, thought of sharing as it covers some important OOPs concepts.
Link to the problem : https://www.geektrust.com/coding/detailed/metro-card