Skip to content

Commit

Permalink
add task solution
Browse files Browse the repository at this point in the history
  • Loading branch information
JenyBerezhna committed Jan 22, 2025
1 parent b1a3d0d commit e0f4dba
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion src/calculateRentalCost.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;

0 comments on commit e0f4dba

Please sign in to comment.