如何为十进制数更改Integer.parseInt()?

时间:2016-08-06 04:50:33

标签: android

    public void showLoanPayments(View clickedButton) {

        double loanAmount = Integer.(mLoanAmount.getText().toString());
        double interestRate = (Integer.parseInt(mInterestRate.getText().toString()));
        double loanPeriod = Integer.parseInt(mLoanPeriod.getText().toString());
        double r = interestRate/1200;
        double r1 = Math.pow(r+1,loanPeriod);

        double monthlyPayment = (double) ((r+(r/(r1-1))) * loanAmount);
        double totalPayment = monthlyPayment * loanPeriod;

        mMonthlyPaymentResult.setText(new DecimalFormat("##.##").format(monthlyPayment));
        mTotalPaymentsResult.setText(new DecimalFormat("##.##").format(totalPayment));
    }
}

1 个答案:

答案 0 :(得分:0)

刚刚发布答案的人?谢谢你,因为我已经解决了这个问题。再次感谢。