From e0f4dbaa3f2a2c6e525c574c049dd48c84085976 Mon Sep 17 00:00:00 2001 From: Jeny Berezhna Date: Wed, 22 Jan 2025 17:05:39 +0000 Subject: [PATCH] add task solution --- src/calculateRentalCost.js | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/calculateRentalCost.js b/src/calculateRentalCost.js index 1e3a27d11..a3e5d501b 100644 --- a/src/calculateRentalCost.js +++ b/src/calculateRentalCost.js @@ -4,7 +4,21 @@ * @return {number} */ function calculateRentalCost(days) { - // write code here + if (days < 3) { + return 40 * days; + } + + if (days === 3) { + return 100; + } + + if (days >= 3 && days < 7) { + return 100 + 40 * (days - 3); + } + + if (days >= 7) { + return 220 + (days - 6) * 10; + } } module.exports = calculateRentalCost;