This class is moving too fast and I only know simple Java programming so far, but we're getting into multiple classes for this savings account program. If anyone can do this I will spam +rep on your for the remainder of your DaniWeb life.
---Data
• the identity number for the account (the identity number is never changed once the account has been constructed)
• the balance in the account (the balance can change as a result of some operations)
---Operations
• create an account with a given identity number and initial balance
• return the identity number
• deposit some positive amount into the account, increasing the balance
• decrease the balance by a specified positive amount; if the amount is greater than the balance throw an IllegalArgumentException
• return the monthly interest due
The Account class needs the things below.
public abstract class Account
{
private int idNumber; / identity number for this account
private double balance; / current balance for this account
private double yearlyInterest; /amount of interest per year for this account
/ precondition: startBal >= 0.0
/ postcondition: An account with identity number idNum and current balance of startBal has been created
public Account (int idNum, double startBal)
/ postcondition: returns the identity number for this account
public int idNumber ( )
/ postcondition: returns the current balance for this account
public double currentBalance ( )
/ precondition: amount >= 0.0
/ postcondition: the current balance of this account has been increased by amount
public void deposit (double amount)
/ precondition: 0.0 <= amount <= balance
/ postcondition: the current balance of this account has been decreased by amount
public void decreaseBalance (double amount)
/ postcondition: returns the monthly interest due for this account
public double monthyInterest ( )
}
The operations for SavingsAccount that differ from those specified in the class Account are the following:
• create a new savings account with a given annual interest rate, as well as the parameters required for all accounts
• withdraw a positive amount that does not exceed the current balance, decreasing the balance by the amount withdrawn
• calculate the monthly interest by multiplying the current balance by the annual interest rate divided by twelve
The operations for CheckingAccount that differ from those specified in the class Account that was described on day 2 are the following.
• create a new checking account with a given per-check charge, as well as the parameters required for all accounts
• clear a check for a given amount by decreasing the balance by the amount of the check plus the per-check charge
• compute and return the monthly interest
The operations for SpecialCheckingAccount that differ from those specified in the class CheckingAccount are the following.
• create a new special checking account with a given minimum balance and interest rate, as well as the parameters required for a checking account
• clear a check for a given amount according to the rules above
• calculate the monthly interest by multiplying current balance by the annual interest rate divided by twelve if the current balance is above the minimum; otherwise, calculate the interest as it is done for a checking account
I do have some code but it really only completes the simple task of creating the Account and giving the user their ID number. Other than that, that's pretty much the long and short of it guys. I'd really appreciate any >HELPFUL< comments or code and not flame for my request.
-IMtheBESTatJAVA