Initial commit

This commit is contained in:
2023-12-17 00:26:14 -05:00
commit 59d97be20c
89 changed files with 3184 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
defmodule FreelancerRates do
def daily_rate(hourly_rate) do
8.0 * hourly_rate
end
def monthly_rate(hourly_rate) do
22.0 * daily_rate(hourly_rate)
end
def monthly_rate(hourly_rate, discount) do
hourly_rate
|> monthly_rate()
|> apply_discount(discount)
|> ceil()
end
def apply_discount(before_discount, discount) do
before_discount - (before_discount * (discount / 100))
end
def days_in_budget(budget, hourly_rate, discount) do
hourly_rate
|> daily_rate()
|> apply_discount(discount)
|> then(fn rate -> budget / rate end)
|> Float.floor(1)
end
end