/*********************************************************************************** * PaymentCalculator is a Java class that can be deployed as a Web Service. The * class provides methods to return the monthly payment amount and the total payment. * * Kelli Wiseth * NDNU | XML and Web services class * 25-November-2004 * *********************************************************************************** */ public class PaymentCalculator { public double getMonthlyPayment (double intRate, double principal, double loanTerm) { double interestRate = intRate/1200; double principalAmt = principal; double term = loanTerm * 12; double loanPmtExponent = Math.pow((1+interestRate), term); double monthlyPaymentAmt = (interestRate + (interestRate / (loanPmtExponent-1))) * principalAmt; return monthlyPaymentAmt; } public double getTotalPayment (double intRate, double principal, double loanTerm) { double interestRate = intRate/1200; double principalAmt = principal; double term = loanTerm * 12; double loanPmtExponent = Math.pow((1+interestRate), term); double totalPaymentAmt = term * ((interestRate + (interestRate / (loanPmtExponent-1))) * principalAmt); return totalPaymentAmt; } }// class PaymentCalculator