Build a Mortgage Amortization Schedule With Extra Monthly Payments

Last updated: November 29, 2026

Quick Overview

Given a loan principal, annual interest rate and term in years, compute the fixed monthly payment and the full amortization schedule. Support an optional extra principal payment each month and report how many months and how much interest it saves.

Zillow
Software Engineering Fundamentals
Software Engineer
Zillow
November 29, 2026
Software Engineer
Technical Screen
Software Engineering Fundamentals
Easy

0

0

0 solved


Given a loan principal, annual interest rate and term in years, compute the fixed monthly payment and the full amortization schedule. Support an optional extra principal payment each month and report how many months and how much interest it saves.

Zillow Home Loans and the mortgage and affordability calculators on every listing page depend on getting this arithmetic exactly right to the cent. The interviewer is checking money handling (no binary floats), the final-payment rounding fix, and a clean loop that stops when the balance hits zero.

What the Interviewer Expects
  • Derive the annuity payment formula and handle a zero rate
  • Use Decimal or integer cents, never float, for balances
  • Round interest each month to cents and make the final payment absorb rounding drift
  • Stop early when extra payments pay off the loan
  • Report total interest and months saved
Key Topics to Cover
fixed-point money
annuity formula
rounding
amortization
How to Approach This
  1. Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
  2. Choose data structures based on access patterns, not familiarity.
  3. Prefer immutable data and message passing over shared mutable state for concurrency.
  4. Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
  • How would you add a one-time lump sum payment in a given month?
  • How would you model an adjustable-rate loan that resets after year five?
  • The calculator on the listing page must update as the user drags a slider. Where does this code run and how do you keep it fast?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice System Design Problems
Sample Answer
Requirements

Inputs: principal PP, annual rate, term in years, optional monthly extra. Outputs: the scheduled payment, each month's interest, principal, and remaining balance, plus total interest. Amounts are i...

High-Level Design

Monthly rate r=annual/12r = \text{annual}/12, n=12⋅yearsn = 12 \cdot \text{years}. Payment M=P⋅r1−(1+r)−nM = P \cdot \frac{r}{1-(1+r)^{-n}}, or P/nP/n when r=0r = 0. Each month: interest is the balance times rr rounded to cents; p...


Submit Your Answer
Markdown supported

Related Questions