-
-
Save anonymous/0d5d728066cf75f305f0c54292b6764a to your computer and use it in GitHub Desktop.
task-1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Goal | |
The goal is to calculate the price of a vehicle depending on the duration and the amount of kilometers. | |
Explanation | |
You find in data.json the pricings for vehicles. Use the data.json together with input.json to generate output.json. Your code should be found in main.rb. | |
Calculations | |
To get the proper price all full weeks should be calculated with the weekly price. The remaining full days with the daily price, the remaining hours with the hourly price. | |
When calculating the prices you should consider if it wouldn't be cheaper to take the daily or weekly price instead. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"vehicles": [ | |
{ | |
"id": 1, | |
"hourly_price": 100, | |
"daily_price": 4500, | |
"weekly_price": 12000, | |
"kilometer_price": 60 | |
}, | |
{ | |
"id": 2, | |
"hourly_price": 250, | |
"daily_price": 5000, | |
"weekly_price": 1500, | |
"kilometer_price": 90 | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"start_at": "2016-10-03T15:00:00+02:00", | |
"end_at": "2016-10-05T21:15:00+02:00", | |
"kilometers": 150 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# implementation here |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"results": [ | |
{ | |
"vehicle_id": 1, | |
"total_price": 18625 | |
}, | |
{ | |
"vehicle_id": 2, | |
"total_price": 15000 | |
} | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment