- By default, any floating-point number defined in C# code is treated as a
double
. To use a different floating-point type (likefloat
ordecimal
), one must add the appropriate suffix to the number.
- When calculating the annual yield, it might be useful to temporarily convert a negative balance to a positive one. One could use arithmetic here, or one of the methods in the
Math
class.
- To calculate the years, one can keep looping until the desired balance is reached. C# has several looping constructs.