Skip to content

louresb/InterestExtensions

Repository files navigation

InterestExtensions

NuGet Version NuGet Downloads Build Status License Development Status

This extension facilitates the calculation of both simple interest and compound interest.


Installation

To install the package via NuGet, you can use the following command:

dotnet add package InterestExtensions

You can also visit the NuGet package page for more information and to download the package.


Features

  • Simple and compound interest calculations
  • Overloads for different compounding periods (yearly, monthly, daily)
  • XML documentation for IntelliSense and API docs
  • Thoroughly unit-tested
  • .NET 8 and above supported

Usage Examples

using InterestExtension;
using InterestExtension.Enums;

decimal principal = 100m;
decimal interestRate = 0.004m;
int period = 7;

// Calculate simple interest (final amount)
decimal simple = principal.CalculateSimpleInterest(interestRate, period);

// Calculate simple interest amount (just the interest earned)
decimal simpleAmount = principal.CalculateSimpleInterestAmount(interestRate, period);

// Calculate compound interest (final amount, annual compounding)
decimal compound = principal.CalculateCompoundInterest(interestRate, period);

// Calculate compound interest (monthly compounding)
decimal compoundMonthly = principal.CalculateCompoundInterest(interestRate, period, InterestPeriod.Monthly);

// Calculate only the interest earned
decimal earned = principal.CalculateCompoundInterestAmount(interestRate, period, InterestPeriod.Daily);

Contributing

Contributions are welcome! If you encounter any issues or have suggestions for improvements, feel free to open an issue or submit a pull request.


License

MIT License © Bruno Loures

About

This extension facilitates the calculation of both simple interest and compound interest.

Topics

Resources

License

Stars

Watchers

Forks

Contributors

Languages