Code written based on Test cases