我没有得到这个程序正确显示我分期付款,我可以请得到一些帮助的感谢......确定定期贷款支付
package Loops;
import java.util.Scanner;
/**
*
*
*/
public class program {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
//variabled decleared
double rate;
double payment;
//input
System.out.print("Enter Loan Amount:");
double principal = input.nextDouble();
System.out.print("Enter Annual Interest:");
double interest = input.nextDouble();
System.out.print("Total payments per year:");//12=monthly,4= quartely,2=semi-annually and 1=annually
double period = input.nextDouble();
System.out.print("Enter Loan Length :");
int length = input.nextInt();
//proces
double n = period * length;
rate = interest/100;
double monthly_rate = rate/period;
payment = principal * (principal * (monthly_rate * Math.pow((1 + monthly_rate), n)));
System.out.printf("Your Monthly sum is %.2f", payment);
}
}
你期待什么,你有什么? – kosa
不是答案,只是遵循java命名约定。包名应以小写字母开头,类名应以大写字母开头。 – PermGenError
我越来越375,但它假设为750,因为我输入500美元和1年50%的利息...... –