-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAccount.cpp
More file actions
67 lines (54 loc) · 1.39 KB
/
Account.cpp
File metadata and controls
67 lines (54 loc) · 1.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Account.cpp
// Purpose: Source file for Account class
#include "Account.h"
/**
* @brief Constructs an Account object with the specified account type, balance, and currency.
* @param accountType The account type.
* @param balance The account balance.
* @param currency The currency of the account.
*/
Account::Account(std::string accountType, double balance, const Currency& currency) :
accountType(accountType), balance(balance), currency(currency) {}
/**
* @brief Prints the account details.
*/
void Account::printAccounts()
{
std::cout << "\t" << accountType << "\t\t" << balance << "\t\t" << currency.getCurrencyCode() << "\n";
}
// Getters
/**
* @brief Gets the balance of the account.
* @return The balance of the account.
*/
double Account::getBalance() const
{
return balance;
}
/**
* @brief Gets the account type of the account.
* @return The account type of the account.
*/
std::string Account::getAccountName() const
{
return accountType;
}
/**
* @brief Gets the currency code of the account.
* @return The currency code of the account.
*/
std::string Account::getCurrencyCode() const
{
return currency.getCurrencyCode();
}
// Setters
/**
* @brief Sets the balance of the account.
* @param newBalance The new balance of the account.
* @return The updated balance of the account.
*/
double Account::setBalance(double newBalance)
{
balance = newBalance;
return balance;
}