All pastes #473315 Raw Edit

Someone

public text v1 · immutable
·published 2007-05-06 05:04 UTC
rendered paste body
/*
 * Loan.java
 *
 * Created on March 1, 2007, 5:46 PM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package lab05;
import java.text.*;
/**
 *
 * @author bowenss26
 */
public class Loan {
        private String borrowerName;
        private int loanId;
        private double downPayment;
        private double propertyCost;
        private int numberOfYears;
        private double annualInterestRate;
        private DecimalFormat prec2 = new DecimalFormat("$#.00");
        
        
        public String getBorrowerName(){
            return borrowerName;
        }
        
        public int getLoanId(){
            return loanId;
        }
        
        public double getDownPayment(){
            return downPayment;
        }
        
        public double getPropertyCost(){
            return propertyCost;
        }
        
        public int getNumberOfYears(){
            return numberOfYears;
        }
        
        public double getAnnualInterestRate(){
            return annualInterestRate;
        }
    
    /** Creates a new instance of Loan */
        public Loan(String nam, int id, double propCost, double downPay, int numYears) {
         
        }
    
    public double calculateMonthlyPayment() {
        double result  = 0;
        
        result = loanId * (annualInterestRate/1200) / (1 - 1 / Math.pow
                (1 + (annualInterestRate/1200), numberOfYears * 12));
        return result;
    }
    
    public String toString() {
        outputStr = "Borrower Name: " + borrowerName + 
                " Loan ID: " + loanID + " Down payment: " + prec2.format(downPayment)";"
                
                return outputStr;
                
    }
    
}