Personal Finance 1.0.0
An application that allows you to track/store/view finances, as well as calculate different financial values.
Formulas Class Reference

The Formulas class is used to calculate different financial values. More...

#include <formulas.h>

Inheritance diagram for Formulas:
Money

Public Member Functions

 Formulas ()
 Default constructor for the Formulas class. More...
 
- Public Member Functions inherited from Money
 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 Public Member Functions inherited from Money
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...
 

Detailed Description

The Formulas class is used to calculate different financial values.

This class performs different mathematical formulas pertaining to personal finance.

Author
Dawson Dauphinais

Constructor & Destructor Documentation

◆ Formulas()

Formulas::Formulas ( )

Default constructor for the Formulas class.

Member Function Documentation

◆ amortization()

static Money Formulas::amortization ( Money  principal,
double  interestRate,
int  numPeriods,
int  paymentsPerPeriod 
)
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.

Attention
Enter the interest rate in the format: 4.56
In most cases, the number of periods should be entered as the number of years the debt is, and the payments per period should be 12.
Parameters
principalA Money object containing the initial value of the debt.
interestRateThe interest rate.
numPeriodsThe number of periods of the debt.
paymentsPerPeriodThe number of payments to be made per period.
Returns
A Money object containing the value of the monthly payment on the given debt.
Author
Dawson Dauphinais

◆ cashFlow()

static Money Formulas::cashFlow ( Money income,
Money expenses 
)
static

Calculates total cash flow.

Parameters
incomeThe income value as a Money object.
expensesThe total expenses value as a Money object.
Returns
A Money object containing the cash flow based on the parameters.
Author
Dawson Dauphinais

◆ compoundAnnualGrowthRate()

static double Formulas::compoundAnnualGrowthRate ( Money beginningVal,
Money endingVal,
int  numPeriods 
)
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.

Parameters
beginningValA Money object containing the initial value.
endingValA Money object containing the final value.
numPeriodsThe number of periods
Returns
The compound annual growth rate.
Author
Dawson Dauphinais

◆ creditCardEquation()

static double Formulas::creditCardEquation ( Money  balance,
Money  monthlyPayment,
double  interestRate 
)
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.

Parameters
balanceA Money object containing the balance of the credit card.
monthlyPaymentA Money object containing the value of the monthly payment being made.
interestRateThe interest rate on the credit card.
Attention
Enter the interest rate in the format: 4.56
Returns
How long it will take to pay off the credit card in years.
Author
Dawson Dauphinais

◆ futureValueOrdinaryAnnuity()

static Money Formulas::futureValueOrdinaryAnnuity ( Money payment,
double  interestRate,
int  numPayments 
)
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.

Attention
Enter the interest rate in the format: 0.456, this is equivalent to 4.56%.
Parameters
paymentA Money object containing the cost of each payment.
interestRateThe interest rate.
numPaymentsThe number of payments to be made.
Returns
A Money object containing the future value of the annuity.
Author
Dawson Dauphinais

◆ leverageRatio()

static double Formulas::leverageRatio ( Money totalLiabilities,
Money totalDebts,
Money totalIncome 
)
static

Calculates a leverage ratio.

Best for measuring your liquidity and determining whether you can afford a loan.

Note
The lower the average is, the better.
Parameters
totalLiabilitiesA Money object containing the value of total liabilities.
totalDebtsA Money object containing the value of total debts.
totalIncomeA Money object containing the value of total income.
Returns
The leverage ratio.
Author
Dawson Dauphinais

◆ ruleOfSeventyTwo()

static double Formulas::ruleOfSeventyTwo ( double  interestRate)
static

Implements the Rule of 72.

A quick approximation of how long it will take to double an investment based on an interest rate.

Attention
Enter the interest rate in the format: 4.56
Parameters
interestRateAn interest rate.
Returns
The amount of time, in years, that it would take to double an investment if the interest rate remained constant.
Author
Dawson Dauphinais