exercism / cpp

Exercism exercises in C++.
https://exercism.org/tracks/cpp
MIT License
259 stars 214 forks source link

freelancer-rates: more explicit tasks #675

Closed ErikSchierboom closed 1 year ago

ErikSchierboom commented 1 year ago

In the freelancer-rates, I think it might be convenient to explicitly mention in the tasks what types students are working with (even though they are in the stub) and what each argument represents.

For example, in the discounted price example there is this code:

apply_discount(150, 10)
// => 135.0

I can probably guess that the first argument is the price before discount, but the task might mention that (or else introduce properly-named variables in the example). Side note: I would probably rename before_discount to price_before_discount.

I personally also prefer the logic to implement to be explained in the tasks themselves, not beforehand.

So instead of having :

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 not-for-profit customers).

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

and the task being:

Implement a function to calculate the daily rate given an hourly rate:

I would have:

The daily rate is 8 times the hourly rate.
Implement the `daily_rate` function to calculate the daily rate given an hourly rate:

(note: I've also explicitly mentioned the function name).