function paymentSchedule() {

  this.schedule = new Array();
  
  this.add = paymentSchedule_add;
  this.clear = paymentSchedule_clear;
  this.getLength = paymentSchedule_getLength;
  this.getElementAt = paymentSchedule_getPayment;
  this.getPayment = paymentSchedule_getPayment;
  
}

function paymentSchedule_add(payment) {
  this.schedule[this.schedule.length] = payment;
}

function paymentSchedule_clear() {
  this.schedule = new Array();
}

function paymentSchedule_getLength() {
  return this.schedule.length;
}

function paymentSchedule_getPayment(index) {
  if ((index >= 0) && (index < this.schedule.length)) {
    return this.schedule[index];
  } else {
    return undefined;
  }
}


/* a payment */
function Payment(principal, interest) {
  
  this.principal = principal;
  this.interest = interest;
  
  this.getPrincipal = Payment_getPrincipal;
  this.getInterest = Payment_getInterest;

}

function Payment_getPrincipal() {
  return this.principal;
}

function Payment_getInterest() {
  return this.interest;

}

