org.cfpm.caves.za
Class SavingsClub

java.lang.Object
  extended by org.cfpm.caves.za.Group
      extended by org.cfpm.caves.za.SavingsClub
Direct Known Subclasses:
BurialSociety, Stokvel

public abstract class SavingsClub
extends Group

An abstract savings club. Used as super-class for Stokvel and BurialSociety.

Author:
Ruth

Field Summary
(package private)  double holdings
          current holdings of the club
(package private)  double monthlyFee
          monthly membership fee.
(package private)  java.util.HashMap<Person,java.lang.Integer> onGrace
          list of members on a grace period
 
Fields inherited from class org.cfpm.caves.za.Group
memberIDs, members, model, name, pcs
 
Constructor Summary
SavingsClub(java.lang.String type, double holdings, java.util.ArrayList<Person> members, SouthAfricaModel model)
          Creates a new savings club of the given type with the given holdings and members
 
Method Summary
 int[] getGracePeriods()
          returns the starts of the currently granted grace periods
 double getHoldings()
          returns the current holdings
 jess.Value[] getMembersOnGrace()
          returns the members currently on a grace period
 double getMonthlyFee()
          returns the monthly membership fee
 void payIn(Person p, double amount)
          lets a member pay in the specified amount
 void removeMember(Person member)
          removes the given member from the club
 void requestGracePeriod(Person member)
          lets the given member request a grace period from the club.
 void setHoldings(double amount)
          sets the holdings to the given amount
 void setMonthlyFee(double amount)
          sets the monthly membership fee
 
Methods inherited from class org.cfpm.caves.za.Group
addMember, addPropertyChangeListener, getMemberIDs, getName, removePropertyChangeListener, setMemberIDs, setName, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

onGrace

java.util.HashMap<Person,java.lang.Integer> onGrace
list of members on a grace period


holdings

double holdings
current holdings of the club


monthlyFee

double monthlyFee
monthly membership fee. Default is 30 Rand

Constructor Detail

SavingsClub

public SavingsClub(java.lang.String type,
                   double holdings,
                   java.util.ArrayList<Person> members,
                   SouthAfricaModel model)
Creates a new savings club of the given type with the given holdings and members

Parameters:
type - the club's type
holdings - the club's holdings
members - the list of members
model - the model
Method Detail

getHoldings

public double getHoldings()
returns the current holdings

Returns:
amount of money

setHoldings

public void setHoldings(double amount)
sets the holdings to the given amount

Parameters:
amount - new holdings

getMonthlyFee

public double getMonthlyFee()
returns the monthly membership fee

Returns:
monthly fee

setMonthlyFee

public void setMonthlyFee(double amount)
sets the monthly membership fee

Parameters:
amount - monthly fee

payIn

public void payIn(Person p,
                  double amount)
lets a member pay in the specified amount

Parameters:
p - the member paying in
amount - the amount the member is paying in

removeMember

public void removeMember(Person member)
removes the given member from the club

Overrides:
removeMember in class Group
Parameters:
member - the member to be removed

requestGracePeriod

public void requestGracePeriod(Person member)
lets the given member request a grace period from the club. This happens when a member can't pay the monthly fee but wants to retain club membership.

Parameters:
member - the requesting member

getMembersOnGrace

public jess.Value[] getMembersOnGrace()
returns the members currently on a grace period

Returns:
list of member names

getGracePeriods

public int[] getGracePeriods()
returns the starts of the currently granted grace periods

Returns:
list of grace period starts (model ticks)