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(double balance, User user, 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 TypeMethodDescriptionvoidConnect a user to the joint account.booleancontainsUser(User user) Check to see if a user is connected to the joint account.getUsers()Get anArrayListof users connected to the joint account.voidremoveUser(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(double balance, User user, String accountName, String currency, int transitNumber, int institutionNumber, int accountNumber) Create a joint account with a balance.- Parameters:
balance- The balance of the account.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.
-
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 anArrayListof users connected to the joint account.- Returns:
- An
ArrayListof users connected to the joint account. This is not theusersfield 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:
trueif the user is connected to the account. If not, it returnsfalse.
-