Transportation on vacation

Instructions: After a hard quarter in the office you decide to get some rest on a vacation. So you will book a flight for you and your girlfriend and try to leave all the mess behind you. You will need a rental car in order for you to get around in your vacation. The manager of the car rental makes you some good offers. Every day 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 code that gives out the total amount for different days(d). Thoughts: I need to declare the mutable variable cost to store the cost of the vacation nights I use the if/else statement, starting with the lower value condition, to go through the given scenarios. This is a CodeWars Challenge of 8kyu Rank (https://www.codewars.com/kata/568d0dd208ee69389d000016)

Mar 17, 2025 - 23:34
 0
Transportation on vacation

Instructions:
After a hard quarter in the office you decide to get some rest on a vacation. So you will book a flight for you and your girlfriend and try to leave all the mess behind you.

You will need a rental car in order for you to get around in your vacation. The manager of the car rental makes you some good offers.

Every day 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 code that gives out the total amount for different days(d).

Thoughts:

  1. I need to declare the mutable variable cost to store the cost of the vacation nights
  2. I use the if/else statement, starting with the lower value condition, to go through the given scenarios. Solution

This is a CodeWars Challenge of 8kyu Rank (https://www.codewars.com/kata/568d0dd208ee69389d000016)