import java.util.Scanner;public class ComputeLoan
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);

System.out.print("Enter yearly interest rate , for example 8.25: ");
double annualInterestRate = input.nextDouble();

double monthlyInterestRate = annualInterestRate / 12;(这里应该是12还是1200?)

System.out.print("Enter number of years as an integer, for example 5: ");

int numberOfYears = input.nextInt();

System.out.print("Enter loan amount, for example 128839: ");

double loanAmount = input.nextDouble();

double monthlyPayment = loanAmount * monthlyInterestRate / (1-1 / Math.pow(1 + monthlyInterestRate, numberOfYears * 12));

double totalPayment = monthlyPayment * numberOfYears * 12;

System.out.println("The monthly payment is " + (int)(monthlyPayment * 100) / 100.0);
System.out.println("The total payment is " + (int)(totalPayment * 100) / 100.0);

}
}在网上查了说年利率/12就是月利率,但是如果按12计算结果貌似不正确,若按1200计算,我不知道1200哪来的!麻烦高手指点一二