Class JointAccount

java.lang.Object
makingtransactions.bankaccounts.BankAccount
makingtransactions.bankaccounts.JointAccount

public class JointAccount extends BankAccount
A bank account class for creating a joint account containing multiple holders.
  • 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

      public ArrayList<User> getUsers()
      Get an ArrayList of users connected to the joint account.
      Returns:
      An ArrayList of users connected to the joint account. This is not the users field of the JointAccount instance/object.
    • addUser

      public void addUser(User user)
      Connect a user to the joint account.
      Parameters:
      user - The user to be added to the joint account.
    • removeUser

      public void removeUser(User user)
      Remove a user from the joint account.
      Parameters:
      user - The user to be removed from the joint account.
    • containsUser

      public boolean containsUser(User user)
      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 returns false.