我正在尝试为任何类型的固定利率分期贷款(包括抵押贷款)制作计算器。这是我用于基本计算器的以下脚本:
EditText myEdit = (EditText) findViewById(R.id.editBalance);
String myEditValue = myEdit.getText().toString();
double loanAmount = Double.parseDouble(myEditValue);
EditText myEdit2 = (EditText) findViewById(R.id.editRate);
String myEditValue2 = myEdit2.getText().toString();
double interestRate = Double.parseDouble(myEditValue2);
EditText myEdit3 = (EditText) findViewById(R.id.editTerm);
String myEditValue3 = myEdit3.getText().toString();
Double loanPeriod = Double.parseDouble(myEditValue3);
double r = interestRate/1200;
double r1 = Math.pow(r+1,loanPeriod);
double editMnthlypmt = (double) ((r+(r/(r1-1))) * loanAmount);
TextView textMnthlypmt = (TextView)findViewById(R.id.textMntlypmt);
textMnthlypmt.setText("" + String.valueOf(editMnthlypmt));
我想为额外的每月付款添加一个文本编辑;但是,我不知道如何计算这个,或者调整我的 editMnthlypmt 方程。
有什么建议么?