We have two type-classes in the scope that provide us with the ability to add and multiply some types:
trait Add[A]:
def add(x: A, y: A): A
trait Multiply[A]:
def multiply(x: A, y: A): A
We need to implement StringMath, which will perform a simple addition of string, but in the case of multiplication it will multiply the first argument by the length of the second one.
Unfortunately, the business department hasn't described why we need this functionality, but we also have to implement a function that will multiply the first and the second arguments and then add the result to the third argument using math. Don't use StringMath: we need a more general solution to have IntMath or DoubleMath too.