-
Notifications
You must be signed in to change notification settings - Fork 10
/
25_car_hire.js
35 lines (24 loc) · 868 Bytes
/
25_car_hire.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
This challenge is taken from CodeWars. A great place to sharpen your algorithm skills.
--
After a hard quarter in the office you decide to get some rest on a vacation.
You will need a rental car in order for you to get around.
The manager of the car rental company makes you some good offers.
Every day that you rent the car costs $40.
If you rent the car for 7 or more days, you get $50 off your total.
Alternatively, if you rent the car for 3 or more days, you get $20 off your total.
Write a function that returns the total cost for (d) days.
Examples:
rentalCarCost(1) -> 40
rentalCarCost(2) -> 80
rentalCarCost(3) -> 100
Check your solution:
mocha tests/25_car_hire_test.js
*/
function rentalCarCost (d) {
let total = 0;
// Your code here!
return total
}
// Leave this line intact
module.exports = rentalCarCost;