The Formulas class is used to calculate different financial values. More...
#include <formulas.h>
Public Member Functions | |
Formulas () | |
Default constructor for the Formulas class. More... | |
![]() | |
Money () | |
Default constructor for the Money class. More... | |
Money (double m) | |
Constructor for the Money class based on a double. More... | |
Money (int d, int c) | |
Constructor for the Money class based on two integers. More... | |
Money (const string &s) | |
Constructor for the Money class based on a string. More... | |
Money | operator- () const |
Overloads the - operator for the Money class. More... | |
Money | operator+ (const Money &m) const |
Overloads the + operator for the Money class. More... | |
Money | operator- (const Money &m) const |
Overloads the - operator for the Money class. More... | |
Money | operator* (double val) const |
Overloads the * operator for the Money class. More... | |
Money | operator/ (double m) const |
Overloads the / operator for the Money class. More... | |
Money | operator/ (Money &m) const |
Overloads the / operator for the Money class. More... | |
bool | operator== (const Money &m) const |
Overloads the == operator for the Money class. More... | |
Static Public Member Functions | |
static Money | cashFlow (Money &income, Money &expenses) |
Calculates total cash flow. More... | |
static Money | futureValueOrdinaryAnnuity (Money &payment, double interestRate, int numPayments) |
Calculates the future value of an ordinary annuity. More... | |
static double | compoundAnnualGrowthRate (Money &beginningVal, Money &endingVal, int numPeriods) |
Calculates the rate an investment would grow if the rate were constant. More... | |
static double | leverageRatio (Money &totalLiabilities, Money &totalDebts, Money &totalIncome) |
Calculates a leverage ratio. More... | |
static double | ruleOfSeventyTwo (double interestRate) |
Implements the Rule of 72. More... | |
static double | creditCardEquation (Money balance, Money monthlyPayment, double interestRate) |
Determines how long it will take to pay off a credit card. More... | |
static Money | amortization (Money principal, double interestRate, int numPeriods, int paymentsPerPeriod) |
Calculates how much a monthly payment on will be on a debt. More... | |
![]() | |
static Money | power (Money &m, int exp) |
Implements the power function for the Money class. More... | |
static double | power (double d, int exp) |
Helper function for the power function of the Money class. More... | |
static double | toDouble (const Money &m) |
Converts a Money object to a double value. More... | |
static string | toString (const Money &m1) |
Converts a Money object to a string. More... | |
The Formulas class is used to calculate different financial values.
This class performs different mathematical formulas pertaining to personal finance.
Formulas::Formulas | ( | ) |
Default constructor for the Formulas class.
|
static |
Calculates how much a monthly payment on will be on a debt.
Best for calculating the cost of long-term debt like mortgages, car loans, etc.
principal | A Money object containing the initial value of the debt. |
interestRate | The interest rate. |
numPeriods | The number of periods of the debt. |
paymentsPerPeriod | The number of payments to be made per period. |
|
static |
Calculates the rate an investment would grow if the rate were constant.
Best for determining average growth rate of any type of investment over multiple years.
beginningVal | A Money object containing the initial value. |
endingVal | A Money object containing the final value. |
numPeriods | The number of periods |
|
static |
Determines how long it will take to pay off a credit card.
Based on the balance of the credit card, the monthly payment being made, and the interest rate on the credit card.
balance | A Money object containing the balance of the credit card. |
monthlyPayment | A Money object containing the value of the monthly payment being made. |
interestRate | The interest rate on the credit card. |
|
static |
Calculates the future value of an ordinary annuity.
Best for seeing what it costs to pay someone with regular payments over time or upfront.
payment | A Money object containing the cost of each payment. |
interestRate | The interest rate. |
numPayments | The number of payments to be made. |
|
static |
Calculates a leverage ratio.
Best for measuring your liquidity and determining whether you can afford a loan.
totalLiabilities | A Money object containing the value of total liabilities. |
totalDebts | A Money object containing the value of total debts. |
totalIncome | A Money object containing the value of total income. |
|
static |
Implements the Rule of 72.
A quick approximation of how long it will take to double an investment based on an interest rate.
interestRate | An interest rate. |