Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 11 additions & 9 deletions exercises/concept/freelancer-rates/.docs/instructions.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
# Instructions

In this exercise you'll be writing code to help a freelancer communicate with a project manager by providing a few utilities to quickly calculate daily and
monthly rates, optionally with a given discount.
In this exercise, you'll be writing code to help a freelancer communicate with a project manager.
Your task is to provide a few utilities to quickly calculate daily and monthly rates, optionally with a given discount.

We first establish a few rules between the freelancer and the project manager:

- The daily rate is 8 times the hourly rate.
- A month has 22 billable days.

Sometimes, the freelancer is offering to apply a discount on their daily rate (for example for their most loyal customers or for non-for-profit customers).
Sometimes, the freelancer is offering to apply a discount on their daily rate (for example for their most loyal customers or not-for-profit customers).

Discounts are modeled as fractional numbers representing percentage, for example `25.0` (25%).
Discounts are modeled as fractional numbers representing percentages, for example, `25.0` (25%).

## 1. Calculate the daily rate given an hourly rate

Implement a function to calculate the daily rate given an hourly rate:
Implement a function called `daily_rate` to calculate the daily rate given an hourly rate as a parameter.
The contract defines that a day has 8 billable hours.

```elixir
FreelancerRates.daily_rate(60)
Expand All @@ -25,7 +26,7 @@ The returned daily rate should be a float.

## 2. Calculate a discounted price

Implement a function to calculate the price after a discount.
Implement a function `apply_discount` to calculate the price after a discount.

```elixir
FreelancerRates.apply_discount(150, 10)
Expand All @@ -36,7 +37,8 @@ The returned value should always be a float, not rounded in any way.

## 3. Calculate the monthly rate, given an hourly rate and a discount

Implement a function to calculate the monthly rate, and apply a discount:
Implement a `monthly_rate` function to calculate the discounted monthly rate.
It takes two parameters, an hourly rate and the discount in percent.

```elixir
FreelancerRates.monthly_rate(77, 10.5)
Expand All @@ -45,9 +47,9 @@ FreelancerRates.monthly_rate(77, 10.5)

The returned monthly rate should be rounded up (take the ceiling) to the nearest integer.

## 4. Calculate the number of workdays given a budget, hourly rate and discount
## 4. Calculate the number of complete workdays given a budget, hourly rate, and discount

Implement a function that takes a budget, an hourly rate, and a discount, and calculates how many days of work that covers.
Implement a function `days_in_budget` that takes a budget, an hourly rate, and a discount, and calculates how many complete days of work that covers.

```elixir
FreelancerRates.days_in_budget(20000, 80, 11.0)
Expand Down
Loading