The Account class is used to perform various operations on an Account object. More...
#include <Account.h>
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... | |
![]() | |
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 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 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.
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.
i | An Income object. |
void Account::addToGrossIncome | ( | Money | m | ) |
Adds a value to the gross income.
Used to add to the gross income on the current account.
m | A Money object that will be added to the gross income on the account. |
void Account::addToIncomeList | ( | Income | i | ) |
Adds an income to the income list.
i | An income object. |
void Account::addTransaction | ( | Expense & | e | ) |
Adds an expense to the transaction list.
e | An Expense object. |
Money Account::getBalance | ( | ) |
Returns the current balance of the account.
Money Account::getGrossIncome | ( | ) |
Returns the gross income on the account.
map< string, string > Account::getIncomeList | ( | ) |
Returns the list of incomes currently on the account.
string Account::getNameOfAccount | ( | ) |
Returns the name of the account.
map< string, string > Account::getRecurringList | ( | ) |
Returns the list of recurring transactions on the account.
Money Account::getTotalFromTransactions | ( | ) |
Returns the total amount spent on transactions.
Money Account::getTotalIncome | ( | ) |
Returns the total amount of income on the account.
map< string, string > Account::getTransactions | ( | ) |
Returns the list of transactions on the account.
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.
void Account::printIncomeList | ( | ) |
Prints a list of all incomes on the account.
Used to view all incomes that have occurred on the account.
void Account::printTransactions | ( | ) |
Prints a list of all transactions on the account.
Used to view all transactions that have occurred on the account.
void Account::setBalance | ( | Money | bal | ) |
Sets the account balance.
Used for updating the balance on the account.
bal | The balance on the account. |
void Account::setIncomeList | ( | map< string, string > | in | ) |
Sets the income list on the account.
Used for updating the list of incomes on the account.
in | The map containing the list of incomes on the account. |
void Account::setName | ( | string | name | ) |
Sets the name of the account.
Used for updating the name of the account.
name | The name of the account. |
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.
mp | The map containing the list of recurring transactions. |
void Account::setTransactions | ( | map< string, string > | mp | ) |
Sets the transactions list on the account.
Used for updating the list of transactions on the account.
mp | The map containing the list of transactions. |
void Account::setValues | ( | string | str, |
Money | bal, | ||
map< string, string > | tr, | ||
map< string, string > | inc | ||
) |
Sets the values of Account.
str | The name of the account. |
bal | The balance on the account. |
tr | The map containing the list of transactions. |
inc | The map containing the list of incomes. |
nlohmann::json Account::toJSON | ( | ) |