Mortgage Calculator
Create a Mortgage Calculator in React that allows users to input loan amount, interest rate, and loan term (years) to calculate the monthly mortgage payment.
Requirements
-
Must have Input fields for:
- Loan amount (in INR) with label="Loan Amount"
- Annual interest rate (in %) with label="Annual Interest Rate"
- Loan term (in years) with id="Loan Term"
-
Show message "Invalid input" for inappropriate inputs
-
Must have a button labelled "Calculate" to calculate the monthly payment
-
Calculate monthly payment using the formula:

where:
- M = monthly payment
- P = loan principal (loan amount)
- r = monthly interest rate = annual rate / 12 / 100
- n = number of monthly payments = years * 12
-
Display the calculated monthly payment.
-
The result (monthly payment) must have aria-label="result"
Constraints & Edge Cases
- Inputs should be non-negative numbers.
- Interest rate cannot be zero or negative.
- Term should be greater than 0 years.
- Monthly payment should be displayed only if inputs are valid.
Reference UI

Solve Similar questions 🔥
Want to upskill? Explore our courses!
Namaste DSA
Master DSA from scratch with numerous problems, and expert guidance.
Namaste React
Wanna dive deep into React and become Frontend Expert? Learn with me now!
Namaste Frontend System Design
The most comprehensive and detailed course for frontend system design.
Namaste Node.js
Wanna dive deep into Node.js? Enroll into `Namaste Node.js` now!
