From beb71c2d145d29721cd21688d07f54c1d2233e5d Mon Sep 17 00:00:00 2001 From: cementix Date: Tue, 21 Jan 2025 16:57:19 +0100 Subject: [PATCH] Solution --- src/calculateRentalCost.js | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/calculateRentalCost.js b/src/calculateRentalCost.js index 1e3a27d11..3813a1eff 100644 --- a/src/calculateRentalCost.js +++ b/src/calculateRentalCost.js @@ -4,7 +4,17 @@ * @return {number} */ function calculateRentalCost(days) { - // write code here + const total = days * 40; + + if (days >= 7) { + return total - 50; + } + + if (days >= 3) { + return total - 20; + } + + return total; } module.exports = calculateRentalCost;