📄 loancalculatortest.java
字号:
import javax.swing.JOptionPane;
import java.text.*;
public class LoanCalculatorTest {
public static void main(String[] args) {
double aloanAmount, monthlyPayment, totalPayment ;
LoanCalculator aLoanCalculator=new LoanCalculator();
aLoanCalculator.setLoanAmount(20000.0);
aLoanCalculator.setLoanPeriod(12);
aLoanCalculator.setAnnualInterestRate(7.0);
monthlyPayment=aLoanCalculator.computeMonthlyPayment();
totalPayment=aLoanCalculator.computeTotalPayment();
aloanAmount=aLoanCalculator.getLoanAmount();
NumberFormat currencyformatter=NumberFormat.getCurrencyInstance();
String output="贷款金额: "+currencyformatter.format(aloanAmount)+"\n"+
"贷款周期: "+aLoanCalculator.getLoanPeriod()+"\n"+
"年利率: "+aLoanCalculator.getAnnualInterestRate()+"%"+"\n"+
"月付款: "+currencyformatter.format(monthlyPayment)+"\n"+
"总付款: "+ currencyformatter.format(totalPayment)+"\n";
JOptionPane.showMessageDialog( null,output,
"结果",+JOptionPane.INFORMATION_MESSAGE);
System.exit(0);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -