The Expense class is used to perform various operations on an Expense object. More...
#include <Expense.h>
Public Member Functions | |
void | setValues (string n, Money &p, string t, string d, bool iR) |
Sets the values of the Expense object. More... | |
void | setName (string name) |
Sets the name of the Expense. More... | |
void | setPrice (Money price) |
Sets the price of the Expense. More... | |
void | setType (string type) |
Sets the type of the Expense. More... | |
void | setDate (string date) |
Sets the date of the Expense. More... | |
void | setIsRecurring (bool isRecurring) |
Sets whether the Expense is recurring or not. More... | |
string | getName () |
Returns the name of the Expense. More... | |
Money | getPrice () |
Returns the price of the Expense. More... | |
string | getType () |
Returns the type of the Expense. More... | |
string | getDate () |
Returns the date of the Expense. More... | |
bool | getIsRecurring () const |
Returns whether the Expense is recurring or not. More... | |
void | printValues () |
Prints the values currently stored in the Expense object. More... | |
string | toString () |
Converts the Expense object into a string. 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 Expense class is used to perform various operations on an Expense object.
The Expense class contains several functions pertaining to interacting with an Expense. It is used by the Account class when adding transactions to an account.
string Expense::getDate | ( | ) |
Returns the date of the Expense.
bool Expense::getIsRecurring | ( | ) | const |
Returns whether the Expense is recurring or not.
string Expense::getName | ( | ) |
Returns the name of the Expense.
string Expense::getType | ( | ) |
Returns the type of the Expense.
void Expense::printValues | ( | ) |
Prints the values currently stored in the Expense object.
Used mainly for debugging purposes.
void Expense::setDate | ( | string | date | ) |
Sets the date of the Expense.
date | The date of the expense. |
void Expense::setIsRecurring | ( | bool | isRecurring | ) |
Sets whether the Expense is recurring or not.
isRecurring | Whether the expense is recurring or not. |
void Expense::setName | ( | string | name | ) |
Sets the name of the Expense.
name | The name of the expense. |
void Expense::setPrice | ( | Money | price | ) |
Sets the price of the Expense.
price | The price of the expense. |
void Expense::setType | ( | string | type | ) |
Sets the type of the Expense.
type | The type of expense. |
void Expense::setValues | ( | string | n, |
Money & | p, | ||
string | t, | ||
string | d, | ||
bool | iR | ||
) |
Sets the values of the Expense object.
n | The name of the expense. |
p | The price of the expense. |
t | The type of expense. |
d | The date of the expense. |
iR | Whether the expense is recurring or not. |
string Expense::toString | ( | ) |
Converts the Expense object into a string.