The goal for this exercise is to practice writing (increasingly complex) recursive code.
For
this exercise, you need to implement the MultR
method in the provided RecursiveMethods class.
This class should be found in the Student_Answers.cs file. The method should take two integer parameters, and will return the product of them. You're not allowed to simply multiply the two numbers inside the function, and return the value, though – you need to find a way, by using simpler mathematical operations on the values that you pass to the successive recursive calls, to get this to happen. MultR needs to correctly calculate the result of multiplying any two whole numbers – positive, negative, and zero.
What you need to do for this exercise:
MultR
, as
described aboveNUnit_Tests_Recursive_Multiplication
class. They
should all pass at this point, and if not, then you should fix your
program so that those tests do pass.