Package makingtransactions.bankaccounts
Class JointAccount
java.lang.Object
makingtransactions.bankaccounts.BankAccount
makingtransactions.bankaccounts.JointAccount
A bank account class for creating a joint account containing multiple
holders.
-
Constructor Summary
ConstructorsConstructorDescriptionJointAccount
(User user, double balance, String accountName, String currency, int transitNumber, int institutionNumber, int accountNumber) Create a joint account with a balance.JointAccount
(User user, String accountName, String currency, int transitNumber, int institutionNumber, int accountNumber) Create a joint account without a balance. -
Method Summary
Modifier and TypeMethodDescriptionvoid
Connect a user to the joint account.boolean
containsUser
(User user) Check to see if a user is connected to the joint account.getUsers()
Get anArrayList
of users connected to the joint account.void
removeUser
(User user) Remove a user from the joint account.Methods inherited from class makingtransactions.bankaccounts.BankAccount
addTransaction, getAccountName, getAccountNumber, getBalance, getCurrency, getInstitutionNumber, getTransactions, getTransitNumber, setAccountName, setAccountNumber, setBalance, setCurrency, setInstitutionNumber, setTransitNumber, toString
-
Constructor Details
-
JointAccount
public JointAccount(User user, double balance, String accountName, String currency, int transitNumber, int institutionNumber, int accountNumber) Create a joint account with a balance.- Parameters:
user
- The first user to hold the account.balance
- The balance of the account.accountName
- The name of the account.currency
- The type of currency.transitNumber
- The transit number.institutionNumber
- The institution number.accountNumber
- The account number.
-
JointAccount
public JointAccount(User user, String accountName, String currency, int transitNumber, int institutionNumber, int accountNumber) Create a joint account without a balance.- Parameters:
user
- The first user to hold the account.accountName
- The name of the account.currency
- The type of currency.transitNumber
- The transit number.institutionNumber
- The institution number.accountNumber
- The account number.
-
-
Method Details
-
getUsers
Get anArrayList
of users connected to the joint account.- Returns:
- An
ArrayList
of users connected to the joint account. This is not theusers
field of the JointAccount instance/object.
-
addUser
Connect a user to the joint account.- Parameters:
user
- The user to be added to the joint account.
-
removeUser
Remove a user from the joint account.- Parameters:
user
- The user to be removed from the joint account.
-
containsUser
Check to see if a user is connected to the joint account.- Parameters:
user
- The user that is being checked.- Returns:
true
if the user is connected to the account. If not, it returnsfalse
.
-