com.cedarspring.tvm
Class InterestRate

java.lang.Object
  |
  +--com.cedarspring.tvm.InterestRate
All Implemented Interfaces:
java.io.Serializable

final class InterestRate
extends java.lang.Object
implements java.io.Serializable

Annual Nominal Interest Rate
Interest is a charge for borrowing money, usually stated as a percentage of the amount borrowed over a specific period of time. Compound interest is calculated each period on the original amount borrowed plus all unpaid interest accumulated to date. Compound interest is always assumed in TVM problems.

This class will:

Version:
1.2.2 15-May-2003
Author:
Cedar Spring Software, Inc.

Nested Class Summary
(package private)  class InterestRate.SolveI
           
(package private)  class InterestRate.SolveIE
           
 
Field Summary
private  int compoundingPerYear
           
private  boolean enterRateAsPercent
           
private  FindRoot findRoot
           
private  IFTables ift
           
private  int paymentsPerYear
           
private  java.math.BigDecimal rateEstimate
           
(package private) static long serialVersionUID
           
private static java.math.BigDecimal UPPER_LIMIT
           
private  java.math.BigDecimal value
           
 
Constructor Summary
(package private) InterestRate()
          Construct a default InterestRate Object.
 
Method Summary
(package private)  void computeValue(java.math.BigDecimal n, java.math.BigDecimal pmt, java.math.BigDecimal fv, java.math.BigDecimal pv, boolean end, Options o)
          Compute annual nominal interest rate.
(package private)  int getCompoundingPerYear()
          Recall compounding periods per year
(package private)  java.math.BigDecimal getEffectiveRate(Options o)
          Recall annual effective interest rate.
(package private)  boolean getEnterRateAsPercent()
          Recall interest rate representation (decimal or percent)
(package private)  java.math.BigDecimal getIE(java.math.BigDecimal nominal, int period, Options o)
           
(package private)  java.math.BigDecimal getIP(Options o)
           
(package private)  int getPaymentsPerYear()
          Recall payments per year.
(package private)  java.math.BigDecimal getRateEstimate()
          Recall interest rate estimate
(package private)  java.math.BigDecimal getValue()
          Recall annual nominal interest rate.
(package private)  void setCompoundingPerYear(int newCompoundingPerYear)
          Store compounding periods per year.
(package private)  void setEnterRateAsPercent(boolean newEnterRateAsPercent)
          Store interest rate representation (decimal or percent)
(package private)  void setPaymentsPerYear(int newPaymentsPerYear)
          Store payments per year.
(package private)  void setRateEstimate(java.math.BigDecimal newRateEstimate)
          Store interest rate estimate.
(package private)  void setValue(java.math.BigDecimal newValue, Options o)
          Store annual nominal interest rate.
 java.lang.String toString()
          Return interestRate as a string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

value

private java.math.BigDecimal value

enterRateAsPercent

private boolean enterRateAsPercent

rateEstimate

private java.math.BigDecimal rateEstimate

compoundingPerYear

private int compoundingPerYear

paymentsPerYear

private int paymentsPerYear

ift

private IFTables ift

findRoot

private FindRoot findRoot

UPPER_LIMIT

private static final java.math.BigDecimal UPPER_LIMIT

serialVersionUID

static final long serialVersionUID
See Also:
Constant Field Values
Constructor Detail

InterestRate

InterestRate()
Construct a default InterestRate Object.

Method Detail

setValue

void setValue(java.math.BigDecimal newValue,
              Options o)
        throws TVMException
Store annual nominal interest rate. Rate is entered as percent (ie. 6.5) or decimal (ie. .065) depending on value of enterRateAsPercent property. The periodic rate is calculated from this property, paymentsPerYear, and compoundingPerYear.

TVMException
See Also:
setEnterRateAsPercent(boolean), setCompoundingPerYear(int), setPaymentsPerYear(int)

getValue

java.math.BigDecimal getValue()
Recall annual nominal interest rate. Rate is returned as percent (ie. 6.5) or decimal (ie. .065) depending on value of enterRateAsPercent property.

Returns:
nominal annual interest rate
See Also:
setEnterRateAsPercent(boolean)

computeValue

void computeValue(java.math.BigDecimal n,
                  java.math.BigDecimal pmt,
                  java.math.BigDecimal fv,
                  java.math.BigDecimal pv,
                  boolean end,
                  Options o)
            throws TVMException
Compute annual nominal interest rate. Compute an approximation of the annual interest rate and set the interestRate property. The presentValue, futureValue, payment, and numberOfPeriods properties must be set before this method is invoked. If the method fails to converge on a rate, try different values for the rateEstimate property.

TVMException

setCompoundingPerYear

void setCompoundingPerYear(int newCompoundingPerYear)
                     throws TVMException
Store compounding periods per year.

TVMException
See Also:
setPaymentsPerYear(int)

getCompoundingPerYear

int getCompoundingPerYear()
Recall compounding periods per year


setPaymentsPerYear

void setPaymentsPerYear(int newPaymentsPerYear)
                  throws TVMException
Store payments per year.

TVMException
See Also:
setCompoundingPerYear(int)

getPaymentsPerYear

int getPaymentsPerYear()
Recall payments per year.


setEnterRateAsPercent

void setEnterRateAsPercent(boolean newEnterRateAsPercent)
Store interest rate representation (decimal or percent)


getEnterRateAsPercent

boolean getEnterRateAsPercent()
Recall interest rate representation (decimal or percent)


setRateEstimate

void setRateEstimate(java.math.BigDecimal newRateEstimate)
Store interest rate estimate.


getRateEstimate

java.math.BigDecimal getRateEstimate()
Recall interest rate estimate


toString

public java.lang.String toString()
Return interestRate as a string

Overrides:
toString in class java.lang.Object

getIP

java.math.BigDecimal getIP(Options o)
                     throws TVMException
TVMException

getIE

java.math.BigDecimal getIE(java.math.BigDecimal nominal,
                           int period,
                           Options o)

getEffectiveRate

java.math.BigDecimal getEffectiveRate(Options o)
Recall annual effective interest rate. Rate is returned as percent (ie. 6.5) or decimal (ie. .065) depending on value of enterRateAsPercent property.

Returns:
effective annual interest rate
See Also:
setEnterRateAsPercent(boolean), setCompoundingPerYear(int), setValue(java.math.BigDecimal, com.cedarspring.tvm.Options)