Back-end Developer Challenge 1
By Software Development and Integration Team
Car Rental Problem
Time: 40-90 minutes.
Given the car rental cost as the following table.
| Size | Seat Capacity | Cost (PHP) |
|---|---|---|
| Small (S) | 5 | 5000 |
| Medium (M) | 10 | 8000 |
| Large (L) | 15 | 12000 |
Write a console application that:
- Read input number (seat) from the command line
- Calculate optimized cost (the cheapest) from the specified number (seat) and print results as below examples.
Please input number (seat): 20
M x 2
Total = PHP 16000
In case there are 2 or more optimized solutions you may print only 1 solution for example.
Please input number (seat): 30
M x 3
Total = PHP 24000
Or
Please input number (seat): 30
L x 2
Total = PHP 24000
** (Optional) Extra points,
Also try to write another version of the solution that can support generic number of seat and cost. For example:
- If the Medium size car seating capacity is changed from 10 to 9 OR
- If the Large size car cost is changed from 12,000 to 11,000 OR both values are changed, your solution will still find the cheapest cost.
–
Please do not ask anyone else for help. We want to see how you code.
–