# Sapient – Coding Exercise for Designing Smart Card System for Delhi Metro

• Last Updated : 04 Mar, 2020

Hi All,

Today i am going to share interview experience with sapient

Round 1: Got a call from HR and initial screening.

I got a call from HR and after discussing with opening after that i got a call from sapient for technical telephonic round.

There was some java basic question like abstraction, inheritance and custom exception and some multi threading question.

Round 2: Machine test

In second round i got a call  for machine test they provided me cab from home pickup and drop which was awesome.

They provided me the coding challenge with below requirement.

### Requirement Scope

1. Develop an API to calculate total in out on a given station ( swipe in + swipe out)
2. API to generate per card report on demand i.e. print all journey details for a given smart card – source station, destination station, date & time of travel, balance, fare, etc.

### Detailed problem statement

Coding Exercise for Designing Smart Card System for Delhi Metro. implement ‘Metro Smart Card System’ (MSCS) for Delhi city. For application assume there is a single metro line covering 10 stations linearly. The stations name are A1, A2, A3, A4, A5, A6, A7, A8, A9, A10 as shown below. The travel can be in any direction.

Travelers have smart cards that behave just like any regular debit card that has an initial balance when purchased. Travelers swipe-in when they enter a metro station and swipe-out when they exit. The card balance is automatically updated at swipe-out.

Objective of the exercise is to create an automated system that has following functionalities:

1. Card should have a minimum balance of Rs 5.5 at swipe-in. At swipe-out, system should calculate the fare based on below strategies set at the start of the day. The fare must be deducted from the card.
2. Card should have the sufficient balance otherwise user should NOT be able to exit. Weekday – Rs. 7 * (Number of stations traveled) Weekend – Rs. 5.5 * (Number of station traveled if it’s Saturday or Sunday) (* there can be more such fare strategies in future)

Solution:

Round 3: Code review round+Final Round

In final round they asked my all question related to coding program which i have written.As i have used many design patterns in my coding challenge they asked me many question s related to design pattern.

As they was looking for a java developer which can work on both java and UI they asked me about Java, Spring, Hibernate, JDBC, Css, Html, Javascript, Shell script.

Finally i was selected in Sapient Global Market 🙂

I got Flower bouquet when i was selected at my home.

My Personal Notes arrow_drop_up