Nothing Special   »   [go: up one dir, main page]

Skip to content

A Toll-Calculator project where we calculate the money collection via toll from travelers as per vehicle type and their return journey.

License

Notifications You must be signed in to change notification settings

sanajitjana/Geektrust-Toll-Calculator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation


Logo

Toll Calculator

The app where we calculate the money collection via toll from travelers as per vehicle type and their return journey.


View Question · Report Bug · Request Feature

Score

About The Project

Context

A new road has been built and is now open for general traffic. The road construction company needs your help in calculating the money collection via toll from travellers.

FASTAG

The construction company prefers money to be collected via FASTAG. FASTAG is an electronic payment utility that can be used to pay tolls. All vehicles have a vehicle number. The FASTAG is associated with a vehicle number. If there is no sufficient balance in the FASTAG, then the remaining cost of the toll needs to be paid by cash. If travellers do not have a FASTAG they can make the payment by Cash. There is a flat fee of 40 for such cash transactions.

Toll charges

Amount of toll collected varies based on the weight of the vehicle.

image

Journey Type

Toll charges are different for a single trip and for a return journey. When a vehicle does a return journey, there is a discount of 50% for the return journey. For eg: If a Van passes through the toll first time, the toll collected is 100. If the same Van passes again through the toll, the amount collected for the return journey is 50. If the Van passes a third time, it will be treated as a new single journey and the toll collected is 100.

Goal

Your task is to build a solution that calculates various tolls collected and print the payment summary and vehicle type summary.

  • The payment summary should give a breakup of the total amount collected and the total discount given.
  • The vehicle type summary should display the total number of vehicles passed per type in descending order of the collection amount.

Assumptions

  • All vehicles passing through has a vehicle number.
  • Some vehicles may not have FASTAG, in that case the toll amount is paid by cash.
  • Some vehicles that have FASTAG may not have sufficient money to pay the toll, then the remaining amount is paid by cash.
  • Tolls are always collected from FASTAG first, then only cash is taken if needed.
  • Every cash transaction has a flat fee of 40.
  • Cash amount collected includes the toll charges paid and the flat fee of 40.
  • The vehicle count is calculated based on journeys. eg: if the same car passes twice, the count is 2.

Sample Input/Output 1

image

Explanation

image

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement". Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License. See LICENSE.txt for more information.

(back to top)

About

A Toll-Calculator project where we calculate the money collection via toll from travelers as per vehicle type and their return journey.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published