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

The Account class is used to perform various operations on an Account object. More...

#include <Account.h>

Inheritance diagram for Account:
Money

Public Member Functions

void setValues (string str, Money bal, map< string, string > tr, map< string, string > inc)
 Sets the values of Account. More...
 
void setName (string name)
 Sets the name of the account. More...
 
void setBalance (Money bal)
 Sets the account balance. More...
 
void setTransactions (map< string, string > mp)
 Sets the transactions list on the account. More...
 
void setRecurringList (map< string, string > mp)
 Sets the recurring transactions list on the account. More...
 
void setIncomeList (map< string, string > in)
 Sets the income list on the account. More...
 
string getNameOfAccount ()
 Returns the name of the account. More...
 
map< string, string > getTransactions ()
 Returns the list of transactions on the account. More...
 
map< string, string > getIncomeList ()
 Returns the list of incomes currently on the account. More...
 
map< string, string > getRecurringList ()
 Returns the list of recurring transactions on the account. More...
 
Money getBalance ()
 Returns the current balance of the account. More...
 
Money getTotalFromTransactions ()
 Returns the total amount spent on transactions. More...
 
Money getGrossIncome ()
 Returns the gross income on the account. More...
 
Money getTotalIncome ()
 Returns the total amount of income on the account. More...
 
void addToIncomeList (Income i)
 Adds an income to the income list. More...
 
void addTransaction (Expense &e)
 Adds an expense to the transaction list. More...
 
void printTransactions ()
 Prints a list of all transactions on the account. More...
 
void printIncomeList ()
 Prints a list of all incomes on the account. More...
 
void printAccountDetails ()
 Prints all details of the current account. More...
 
void updateBalance (Money &m)
 Updates the current balance of the account. More...
 
void addIncome (Income i)
 Adds an income to the current account. More...
 
void addToGrossIncome (Money m)
 Adds a value to the gross income. More...
 
nlohmann::json toJSON ()
 Converts the Account object into a nlohmann::json object. 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...
 

Additional Inherited Members

- 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 Account class is used to perform various operations on an Account object.

The Account class contains several functions pertaining to interacting with the user's account. It is used in the main program to create an account object and store various values in the object.

Author
Dawson Dauphinais

Member Function Documentation

◆ addIncome()

void Account::addIncome ( Income  i)

Adds an income to the current account.

This function will update the income list, the gross income on the account, as well as the current balance of the account.

Parameters
iAn Income object.
See also
addToIncomeList(Income i) addToGrossIncome(Money m) updateBalance(Money &m)
Author
Dawson Dauphinais

◆ addToGrossIncome()

void Account::addToGrossIncome ( Money  m)

Adds a value to the gross income.

Used to add to the gross income on the current account.

Parameters
mA Money object that will be added to the gross income on the account.
Author
Dawson Dauphinais

◆ addToIncomeList()

void Account::addToIncomeList ( Income  i)

Adds an income to the income list.

Parameters
iAn income object.
Author
Dawson Dauphinais

◆ addTransaction()

void Account::addTransaction ( Expense e)

Adds an expense to the transaction list.

Parameters
eAn Expense object.
Author
Dawson Dauphinais

◆ getBalance()

Money Account::getBalance ( )

Returns the current balance of the account.

Returns
The current balance of the account.
Author
Dawson Dauphinais

◆ getGrossIncome()

Money Account::getGrossIncome ( )

Returns the gross income on the account.

Returns
The gross income on the account.
Author
Dawson Dauphinais

◆ getIncomeList()

map< string, string > Account::getIncomeList ( )

Returns the list of incomes currently on the account.

Returns
The map of the current incomes on the account.
Author
Dawson Dauphinais

◆ getNameOfAccount()

string Account::getNameOfAccount ( )

Returns the name of the account.

Returns
The name of the account.
Author
Dawson Dauphinais

◆ getRecurringList()

map< string, string > Account::getRecurringList ( )

Returns the list of recurring transactions on the account.

Returns
The map of the current recurring transactions on the account.
Author
Dawson Dauphinais

◆ getTotalFromTransactions()

Money Account::getTotalFromTransactions ( )

Returns the total amount spent on transactions.

Returns
The total value of all the transactions.
Author
Dawson Dauphinais

◆ getTotalIncome()

Money Account::getTotalIncome ( )

Returns the total amount of income on the account.

Returns
The total amount of income on the account.
Author
Dawson Dauphinais

◆ getTransactions()

map< string, string > Account::getTransactions ( )

Returns the list of transactions on the account.

Returns
The map of the current transactions on the account.
Author
Dawson Dauphinais

◆ printAccountDetails()

void Account::printAccountDetails ( )

Prints all details of the current account.

Prints the name of the account, the current balance, the transaction history, and the income history.

Author
Dawson Dauphinais

◆ printIncomeList()

void Account::printIncomeList ( )

Prints a list of all incomes on the account.

Used to view all incomes that have occurred on the account.

Author
Dawson Dauphinais

◆ printTransactions()

void Account::printTransactions ( )

Prints a list of all transactions on the account.

Used to view all transactions that have occurred on the account.

Author
Dawson Dauphinais

◆ setBalance()

void Account::setBalance ( Money  bal)

Sets the account balance.

Used for updating the balance on the account.

Parameters
balThe balance on the account.
Author
Dawson Dauphinais

◆ setIncomeList()

void Account::setIncomeList ( map< string, string >  in)

Sets the income list on the account.

Used for updating the list of incomes on the account.

Parameters
inThe map containing the list of incomes on the account.
Author
Dawson Dauphinais

◆ setName()

void Account::setName ( string  name)

Sets the name of the account.

Used for updating the name of the account.

Parameters
nameThe name of the account.
Author
Dawson Dauphinais

◆ setRecurringList()

void Account::setRecurringList ( map< string, string >  mp)

Sets the recurring transactions list on the account.

Used for updating the list of recurring transactions on the account.

Parameters
mpThe map containing the list of recurring transactions.
Author
Dawson Dauphinais

◆ setTransactions()

void Account::setTransactions ( map< string, string >  mp)

Sets the transactions list on the account.

Used for updating the list of transactions on the account.

Parameters
mpThe map containing the list of transactions.
Author
Dawson Dauphinais

◆ setValues()

void Account::setValues ( string  str,
Money  bal,
map< string, string >  tr,
map< string, string >  inc 
)

Sets the values of Account.

Parameters
strThe name of the account.
balThe balance on the account.
trThe map containing the list of transactions.
incThe map containing the list of incomes.
Author
Dawson Dauphinais

◆ toJSON()

nlohmann::json Account::toJSON ( )

Converts the Account object into a nlohmann::json object.

Used for storing the account information in json format.

Returns
A nlohmann::json object that is the equivalent of the current Account object.
Author
Dawson Dauphinais

◆ updateBalance()

void Account::updateBalance ( Money m)

Updates the current balance of the account.

Parameters
mA Money object that will change the balance of the account.
Author
Dawson Dauphinais