bank
Class Savings

java.lang.Object
  |
  +--bank.Account
        |
        +--bank.Savings
All Implemented Interfaces:
java.lang.Cloneable, java.lang.Comparable

public class Savings
extends bank.Account


Field Summary
static double intRate
           
 
Fields inherited from class bank.Account
acctNum, balance, PIN
 
Constructor Summary
Savings()
          Creates a default new instance of Savings
Savings(java.lang.String pin, double bal)
          Creates a new instance of Savings given a pin and balance
Savings(java.lang.String acct, java.lang.String pin, double bal)
          Creates a new instance of Savings given an account number, pin and balance
 
Method Summary
static double getIntRate()
          we need a way of determining the interest rate Static - since interest rate is static - once per class
 double getIntYTD()
          report the year to date interest
static void main(java.lang.String[] args)
           
 double payInterest(int numDays)
          pay interest into the calling Account based on the number of days paying interest for (also, the class knows the interest rate) Return: amount of interest paid
 boolean payInterestfirstVersion(int numDays)
          MAR - I think the above is better pay interest into the calling Account based on the number of days paying interest for (also, the account knows the interest rate) Return: whether interest is paid
 double processMonthEnd()
          process month end - pay interest into the calling Account default version - pays based on 30 day months Return: new balance
 double processMonthEnd(int days)
          process month end - pay interest into the calling Account default version - pays based on days in month - passed Return: new balance
 void resetIntYTD()
          reset the year to date interest back to zero
static void setIntRate(double rate)
          we need a way of setting the interest rate Static - since interest rate is static - once per class
 void setIntYTD(double amt)
          change the year to date interest
 java.lang.String toString()
          Override Account's toString
 
Methods inherited from class bank.Account
compareTo, deposit, depositEx, equals, getAcctID, getAcctNum, getBal, getPin, matchAcctNum, matchAcctNum, setAcctId, setAcctNum, setBal, setPIN, withdraw
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

intRate

public static double intRate
Constructor Detail

Savings

public Savings()
Creates a default new instance of Savings


Savings

public Savings(java.lang.String pin,
               double bal)
Creates a new instance of Savings given a pin and balance


Savings

public Savings(java.lang.String acct,
               java.lang.String pin,
               double bal)
Creates a new instance of Savings given an account number, pin and balance

Method Detail

payInterest

public double payInterest(int numDays)
pay interest into the calling Account based on the number of days paying interest for (also, the class knows the interest rate) Return: amount of interest paid


payInterestfirstVersion

public boolean payInterestfirstVersion(int numDays)
MAR - I think the above is better pay interest into the calling Account based on the number of days paying interest for (also, the account knows the interest rate) Return: whether interest is paid


processMonthEnd

public double processMonthEnd()
process month end - pay interest into the calling Account default version - pays based on 30 day months Return: new balance


processMonthEnd

public double processMonthEnd(int days)
process month end - pay interest into the calling Account default version - pays based on days in month - passed Return: new balance


getIntYTD

public double getIntYTD()
report the year to date interest


getIntRate

public static double getIntRate()
we need a way of determining the interest rate Static - since interest rate is static - once per class


toString

public java.lang.String toString()
Override Account's toString

Overrides:
toString in class bank.Account

setIntYTD

public void setIntYTD(double amt)
change the year to date interest


resetIntYTD

public void resetIntYTD()
reset the year to date interest back to zero


setIntRate

public static void setIntRate(double rate)
we need a way of setting the interest rate Static - since interest rate is static - once per class


main

public static void main(java.lang.String[] args)
Parameters:
args - the command line arguments little test driver