ADT for BankAccount Members: protected static long assignAccountNumber protected double penalty protected long acctNumber; protected double balance; private String name; Methods: Constructor: PRECONDITIONS: none INPUT: Accountname and OpeningBalance PROCESS: It creates the account and assigns name to be Accountname and balance to be OpeningBalance. It assigns accNumber to be assignAccountNumber and increments assignAccountNumber by one. OUTPUT: none POSTCONDITIONS: The account is created and name, accNumber, and balance have been assigned. Constructor: PRECONDITIONS: none INPUT: Accountname PROCESS: It creates the account and assigns name to be Accountname and balance to be zero. It assigns accNumber to be assignAccountNumber and increments assignAccountNumber by one. OUTPUT: none POSTCONDITIONS: The account is created and name and accNumber have been assigned. balance is set to zero. deposit PRECONDITIONS: amount must be positive INPUT: amount to be deposited PROCESS: It adds the amount to the balance. It returns a 0 if done correctly, a 1 if amount is not positive. of the outcome of the transaction. OUTPUT: int POSTCONDITIONS: balance is changed withdraw PRECONDITIONS: amount be positive. There must be sufficient funds to cover the withdrawal. INPUT: amount to be withdrawn PROCESS: It subtracts the amount from balance. If there is not sufficient funds for withdrawal, a penalty is assessed. It returns a 0 if done correctly, a 1 if the amount sent is negative, and a 2 if there is insufficient funds. OUTPUT: int POSTCONDITIONS: balance is changed transfer PRECONDITIONS: amount be positive. There must be sufficient funds to cover the withdrawal. INPUT: amount to be transferred and acc to where transfer is to put PROCESS: It subtracts the amount. If there is not sufficient funds for withdrawal, a penalty is assessed. It deposits the amount into the transfer account. It returns a 0 if done correctly, a 1 if the amount sent is negative, and a 2 if there is insufficient funds. OUTPUT: int POSTCONDITIONS: balance is changed getBalance PRECONDITIONS: none INPUT: none PROCESS: It returns the current balance. OUTPUT: balance POSTCONDITIONS: none getAccountNumber PRECONDITIONS: none INPUT: none PROCESS: It returns the acctNumber. OUTPUT: acctNumber POSTCONDITIONS: none getName PRECONDITIONS: none INPUT: none PROCESS: It returns the name. OUTPUT: name POSTCONDITIONS: none setName PRECONDITIONS: none INPUT: the new name PROCESS: It sets the name to its new value. OUTPUT: none POSTCONDITIONS: name has been changed getPenalty PRECONDITIONS: none INPUT: none PROCESS: It returns the penalty. OUTPUT: penalty POSTCONDITIONS: none setPenalty PRECONDITIONS: none INPUT: the new penalty PROCESS: It sets the penalty to its new value. OUTPUT: none POSTCONDITIONS: penalty has been changed toString PRECONDITIONS: none INPUT: none PROCESS: It returns a string which is to be used in the System.out to generate output. OUTPUT: A String which is the output of printing the account. POSTCONDITIONS: none ADT for Checking This extends BankAccount Members: protected double fee Methods: Constructor: PRECONDITIONS: none INPUT: AccountName, OpeningBalance, and fee PROCESS: It creates the account and assigns ownerName to be AccountName and balance to be OpeningBalance. It assigns accNumber to be assignAccountNumber and increments assignAccountNumber by one. It assigns the value of fee. OUTPUT: none POSTCONDITIONS: The account is created and name, accNumber, and balance have been assigned. Constructor: PRECONDITIONS: none INPUT: AccountName and fee PROCESS: It creates the account and assigns ownerName to be Accountname and balance to be zero. It assigns accNumber to be assignAccountNumber and increments assignAccountNumber by one. It assigns the value of fee. OUTPUT: none POSTCONDITIONS: The account is created and name and accNumber have been assigned. balance is set to zero. withdraw PRECONDITIONS: amount be positive. There must be sufficient funds to cover the withdrawal. INPUT: amount to be withdrawn PROCESS: It subtracts the amount and fee from balance. If there is not sufficient funds for withdrawal, a penalty is assessed. and a 2 if there is insufficient funds. It returns a 0 if done correctly and 1 if the amount sent is negative. OUTPUT: int POSTCONDITIONS: balance is changed transfer PRECONDITIONS: amount be positive. There must be sufficient funds to cover the withdrawal. INPUT: amount to be transferred and acc to where transfer is to put PROCESS: It does the same transfer as BankAccount. However, if the amount can not be transferred to the transfer account, no withdrawal fee is charged. It returns a 0 if done correctly, 1 if the amount sent is negative, and a 2 if there is insufficient funds. OUTPUT: int POSTCONDITIONS: balance is changed getFee PRECONDITIONS: none INPUT: none PROCESS: It returns the fee. OUTPUT: fee POSTCONDITIONS: none setFee PRECONDITIONS: none INPUT: the new fee PROCESS: It sets the fee to its new value. OUTPUT: none POSTCONDITIONS: fee has been changed toString PRECONDITIONS: none INPUT: none PROCESS: It returns the information for a general account plus the fee for the account. OUTPUT: String POSTCONDITIONS: none ADT for Savings This extends BankAccount Members: protected double interestRate Methods: Constructor: PRECONDITIONS: none INPUT: AccountName, OpeningBalance, and interestRateAccount PROCESS: It creates the account and assigns name to be AccountName and balance to be OpeningBalance. It assigns accNumber to be assignAccountNumber and increments assignAccountNumber by one. It assigns interestRate to interestRateAccount OUTPUT: none POSTCONDITIONS: The account is created and name, accNumber, interestRate, and balance have been assigned. Constructor: PRECONDITIONS: none INPUT: AccountName and interestRate PROCESS: It creates the account and assigns name to be Accountname and balance to be zero. It assigns accNumber to be assignAccountNumber and increments assignAccountNumber by one. It assigns interestRate to interestRateAccount OUTPUT: none POSTCONDITIONS: The account is created and name and accNumber have been assigned. balance is set to zero. calculateInterest PRECONDITIONS: none INPUT: none PROCESS: It calculates the interest earned and adds it to the balance OUTPUT: none POSTCONDITIONS: the balance has been changed getInterestRate PRECONDITIONS: none INPUT: none PROCESS: It returns the interestRate. OUTPUT: interestRate POSTCONDITIONS: none setInterestRate PRECONDITIONS: none INPUT: the new interestRate PROCESS: It sets the interestRate to its new value. OUTPUT: none POSTCONDITIONS: interestRate has been changed toString PRECONDITIONS: none INPUT: none PROCESS: It returns the information for a general account plus the interest rate for the account. OUTPUT: String POSTCONDITIONS: none ADT for Money Market This extends Savings Members: private double minimumAmount private double minimumBalance Methods: Constructor: PRECONDITIONS: none INPUT: AccountName, OpeningBalance, interestRateAccount, and minimumBalanceAccount, minimumAmountStart PROCESS: It creates the account and assigns name to be AccountName and balance to be OpeningBalance. It assigns accNumber to be assignAccountNumber and increments assignAccountNumber by one. It assigns interestRate to be interestRateAccount, minimumBalance to be minimumBalanceAccount, and minimumAmount to be mimimumAmountStart OUTPUT: none POSTCONDITIONS: The account is created and name, accNumber, interestRate, minimumBalance, and balance have been assigned. Constructor: PRECONDITIONS: none INPUT: AccountName, interestRateAccount, minimumBalanceAccount, minimumAmountStart PROCESS: It creates the account and assigns name to be Accountname and balance to be zero. It assigns accNumber to be assignAccountNumber and increments assignAccountNumber by one. It assigns interestRate to interestRateAccount and minimumBalance to be minimumBalanceAccount. It assigns minimumAmountStart to minimumAmount. OUTPUT: none POSTCONDITIONS: The account is created and name and accNumber have been assigned. The interestRate, minimumAmount, and minimumBalance have been assigned. balance is set to zero. withdraw PRECONDITIONS: amount be positive. There must be sufficient funds to cover the withdrawal. The amount must be at least the minimumAmount. INPUT: amount to be withdrawn PROCESS: It subtracts the amount from balance. If there is not sufficient funds for withdrawal, a penalty is assessed. If the withdrawal is less than the minimumAmount, no transaction is done, but no penalty is assessed. If the withdrawal would make the balance less than the minimumBalance, the transaction is not done and a penalty is assessed. The penalty is the same as the penalty for overdrawn accounts. It returns a 0 if done correctly, 1 if the amount sent is negative, and a 2 if there is insufficient funds. It returns a 3 if the amount is less than the minimumAmount and a 4 if the amount would have becomes less than the minimumBalance. OUTPUT: int POSTCONDITIONS: balance is changed deposit PRECONDITIONS: amount be positive. The amount must be at least the minimumAmount. INPUT: amount to be withdrawn PROCESS: It adds the amount to the balance. If the amount is less than the minimumAmount, no transaction is done, but no penalty is assessed. It returns a 0 if done correctly, 1 if the amount sent is negative. It returns a 3 if the amount is less than the minimumAmount. OUTPUT: int POSTCONDITIONS: balance is changed transfer PRECONDITIONS: amount be positive. There must be sufficient funds to cover the withdrawal. The amount must be at least the minimumAmount. INPUT: amount to be withdrawn, and the account to which the amount is to be transferred. PROCESS: It subtracts the amount from balance. If there is not sufficient funds for withdrawal, a penalty is assessed. If the withdrawal is less than the minimumAmount, no transaction is done, but no penalty is assessed. If the withdrawal will take the balance below the minimumBalance, the transaction is not done and a penalty is accessed. The amount is then deposited in the transfer account. It returns a 0 if done correctly, 1 if the amount sent is negative, and a 2 if there is insufficient funds. It returns a 3 if the amount is less than the minimumAmount and a 4 if the amount becomes less than the minimumBalance. If the funds can not be deposited into the transferred account, the funds are put back into the account. OUTPUT: int POSTCONDITIONS: balance is changed getMinimumAmount PRECONDITIONS: none INPUT: none PROCESS: It returns the minimumAmount. OUTPUT: minimumAmount POSTCONDITIONS: none setMinimumAmount PRECONDITIONS: none INPUT: the new minimumAmount PROCESS: It sets the minimumAmount to its new value. OUTPUT: none POSTCONDITIONS: minimumAmount has been changed getMinimumBalance PRECONDITIONS: none INPUT: none PROCESS: It returns the minimumBalance. OUTPUT: minimumAmount POSTCONDITIONS: none setMinimumBalance PRECONDITIONS: none INPUT: the new minimumBalanc3 PROCESS: It sets the minimumBalance to its new value. OUTPUT: none POSTCONDITIONS: minimumAmount has been changed toString PRECONDITIONS: none INPUT: none PROCESS: It returns the information for a savings account plus the minimum amount for a transaction for the account. OUTPUT: String POSTCONDITIONS: none ADT for CD This extends Savings Members: private GregorianCalendar calendar private int lengthOfCD, number of months private int startMonth private int startYear Methods: Constructor: PRECONDITIONS: none INPUT: AccountName, OpeningBalance, interestRateAccount, duration, month,year PROCESS: It creates the account and assigns name to be AccountName and balance to be OpeningBalance. It assigns accNumber to be assignAccountNumber and increments assignAccountNumber by one. It assigns interestRate to interestRateAccount. It creates the GregorianCalendar. It assigns duration to lengthOfCD, month to startMonth, year to startYear. OUTPUT: none POSTCONDITIONS: The account is created and name, accNumber, interestRate, lengthOfCd, startMonth,startYear,and balance have been assigned. Constructor: PRECONDITIONS: none INPUT: AccountName, interestRate, duration, month, year PROCESS: It creates the account and assigns name to be Accountname and balance to be zero. It assigns accNumber to be assignAccountNumber and increments assignAccountNumber by one. It assigns interestRate to interestRateAccount. It creates the GregorianCalendar. It assigns duration to lengthOfCD, month to startMonth, year to startYear. OUTPUT: none POSTCONDITIONS: The account is created and name, accNumber, interestRate, lengthOfCd, startMonth,startYear,and balance have been assigned. withdraw PRECONDITIONS: amount be positive. There must be sufficient funds to cover the withdrawal. INPUT: amount to be withdrawn PROCESS: It subtracts the amount from balance. If there is not sufficient funds for withdrawal, a penalty is assessed. If a withdrawal is done before the allotted time, then a penalty is imposed. The penalty we will impose is that if the CD is for a duration of 6 months or less, one pays a penalty of 90 days of interest. If the duration is more than 6 months, one pays a penalty of 180 days of interest. It returns a 0 if done correctly, 1 if the amount sent is negative, and a 2 if there is insufficient funds. It returns a 5 if a penalty has been imposed for early withdrawal. It send a 6 if both insufficent funds and a penalty for early withdrawal. OUTPUT: int POSTCONDITIONS: balance is changed deposit PRECONDITIONS: amount be positive. INPUT: amount to be withdrawn PROCESS: No deposits are allowed during the time period as well. A It returns a 0 if done correctly, 1 if the amount sent is negative, and a 7 if the transaction is attempted when it can not be done. OUTPUT: int POSTCONDITIONS: balance is changed transfer PRECONDITIONS: amount be positive. There must be sufficient funds to cover the withdrawal. INPUT: amount to be withdrawn, acc to transfer amount PROCESS: It subtracts the amount from balance. If there is not sufficient funds for withdrawal, a penalty is assessed. If a withdrawal is done before the allotted time, then a penalty is imposed. The penalty we will impose is that if the CD is for a duration of 6 months or less, one pays a penalty of 90 days of interest. If the duration is more than 6 months, one pays a penalty of 180 days of interest. The amount is then deposited in the transferred account. It returns a 0 if done correctly, 1 if the amount sent is negative, and a 2 if there is insufficient funds. It returns a 5 if a penalty has been imposed for early withdrawal. It send a 6 if both insufficent funds and a penalty for early withdrawal. OUTPUT: int POSTCONDITIONS: balance is changed getLengthOfCD PRECONDITIONS: none INPUT: none PROCESS: It returns the lengthOfCD. OUTPUT: int, lengthOfCD POSTCONDITIONS: none getStartMonth PRECONDITIONS: none INPUT: none PROCESS: It returns the startMonth. OUTPUT: int, startMonth POSTCONDITIONS: none getStartYear PRECONDITIONS: none INPUT: none PROCESS: It returns the startYear. OUTPUT: int, startYear POSTCONDITIONS: none toString PRECONDITIONS: none INPUT: none PROCESS: It returns the information for a savings account plus the length of the CD and its start month and year. OUTPUT: String POSTCONDITIONS: none