I have recently taken over a web development project for a local car rental company and need help finding out how to calculate the Daily, Weekly, and Monthly cost of a vehicle.
The previous developer used a plugin that allowed you to create "Pricing Schemes" where you define a day range and its price:
19.99/day, 99.99/week, 299.99/month:
Day 1-5 = $19.99
Day 5-6 = $16.665
Day 6-7 = 14.284
Day 7-8 = $14.9975
and so on...
Sadly the developer left no notes on how he got these numbers and each pricing scheme he made only extends to the 31st day. Which causes an issue when a user wants to rent a car for longer than a month (Which is common).
What I need help finding out is the equation he used to get these numbers so I can add on to the pricing schemes and create others if the need arises. I will add a screenshot of a full pricing scheme for reference below.
Any help with this would be greatly appreciated and I will be available to answer any questions if my question is not clear enough and I apologize if I am posting in the wrong place :( just any help at all would be amazing. Thank you!
Seems like these represent your optimal daily costs depending on the number of days you are renting. Thus, if you rent for $5$ or fewer days, you are best off with the daily rate of $\$19.99$ a day. If you rent for exactly $6$ days, you should take the weekly rate of $\$99.99$ in which case you pay an effective daily rate of $$\$\frac {99.99}6=\$16.665$$
If you rent for $7$ days you pay an effective daily rate of
$$\$\frac {99.99}7=\$14.284$$
If you rent for exactly $8$ days you pay the weekly rate plus one day's worth of the daily rate, so you pay an effective daily rate of $$\$\frac {99.99+19.99}8=\$14.9975$$
And so on.