From acb4d15e5bb7d2e85703e3a8d031e37bcd59b4bd Mon Sep 17 00:00:00 2001 From: angiokas Date: Wed, 12 Mar 2025 00:39:38 -0500 Subject: [PATCH] Updated Freelancer Rates exercise instructions. Added information about using the library to be able to use floor() and ceil() functions for part 3 and 4 of this exercise. --- exercises/concept/freelancer-rates/.docs/instructions.md | 5 +++++ exercises/concept/freelancer-rates/freelancer_rates.cpp | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/exercises/concept/freelancer-rates/.docs/instructions.md b/exercises/concept/freelancer-rates/.docs/instructions.md index d6b95b3c..94d065a4 100644 --- a/exercises/concept/freelancer-rates/.docs/instructions.md +++ b/exercises/concept/freelancer-rates/.docs/instructions.md @@ -12,6 +12,11 @@ Sometimes, the freelancer is offering to apply a discount on their daily rate (f Discounts are modeled as fractional numbers representing percentages, for example, `25.0` (25%). +For this exercise, you may want to use the functions `floor()` and `ceil()` from the `` library. You can include the library like so: +```cpp +#import +``` + ## 1. 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. diff --git a/exercises/concept/freelancer-rates/freelancer_rates.cpp b/exercises/concept/freelancer-rates/freelancer_rates.cpp index cdf8897b..e18362cf 100644 --- a/exercises/concept/freelancer-rates/freelancer_rates.cpp +++ b/exercises/concept/freelancer-rates/freelancer_rates.cpp @@ -15,7 +15,7 @@ double apply_discount(double before_discount, double discount) { } // monthly_rate calculates the monthly rate, given an hourly rate and a discount -// The returned monthly rate is rounded up to the nearest integer. +// The returned monthly rate is rounded up (take the ceiling) to the nearest integer. int monthly_rate(double hourly_rate, double discount) { // TODO: Implement a function to calculate the monthly rate, and apply a // discount.