Skip to content

Commit

Permalink
Solution
Browse files Browse the repository at this point in the history
  • Loading branch information
ForDeOne committed Dec 21, 2024
1 parent b1a3d0d commit f5a4b6e
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/calculateRentalCost.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,20 @@
* @return {number}
*/
function calculateRentalCost(days) {
// write code here
let sum = 40 * days;
let discount = 0;

if (days >= 3) {
discount += 20;
}

if (days >= 7) {
discount += 30;
}

sum = sum - discount;

return sum;
}

module.exports = calculateRentalCost;

0 comments on commit f5a4b6e

Please sign in to comment.