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
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.
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.
Amount of toll collected varies based on the weight of the vehicle.
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.
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.
- 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.
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!
- Fork the Project
- Create your Feature Branch (
git checkout -b feature/AmazingFeature
) - Commit your Changes (
git commit -m 'Add some AmazingFeature'
) - Push to the Branch (
git push origin feature/AmazingFeature
) - Open a Pull Request
Distributed under the MIT License. See LICENSE.txt
for more information.