Build a simple mortgage calculator widget that allows users to calculate monthly mortgage payments.
Requirements:
- Inputs:
- Loan amount ($)
- Annual interest rate (%)
- Loan term (in years)
- Outputs:
- Monthly mortgage payment
- Total payment amount
- Total interest paid
- If a non-numeric or invalid input is provided, display an error message.
- Round all result amounts to 2 decimal places.
- Use the formula:
M = P(i(1+i)^n) / ((1+i)^n - 1)
Where:
- M = Monthly mortgage payment
- P = Loan amount
- i = Monthly interest rate (APR / 12)
- n = Total number of payments (years × 12)