Feature #4: Fare in Words

Implementing the "Fare in Words" feature for our "Uber" project.


At the end of a ride, the Uber app displays the fare to the customer. For accessibility, we want the fare to be read out, should the customer so choose. Assuming that the ride fare is an integer and that a text to speech engine is available, all we need to do is to convert the fare to English words. For example, we need to change $120 to one hundred and twenty dollars. The fare may be as high as several billion depending on the country the ride is taken in.

We’ll be provided with an integer number, fare, which represents the fare. Our task will be to convert fare to its English word representation.

Level up your interview prep. Join Educative to access 70+ hands-on prep courses.