{
  "name": "CalcMyCompound debt payoff test cases",
  "version": "1.0.0",
  "publisher": "Kymata Labs LLC",
  "documentation": "https://www.calcmycompound.com/en/tools/debt-payoff/",
  "license": "CC BY 4.0",
  "conventions": [
    "apr is the annual percentage rate in percent; interest accrues monthly at apr/12 on the balance at the start of the month.",
    "payment is made at the end of every month after interest; the final payment clears whatever is left, so it is usually smaller.",
    "Expected values are full precision to six decimals, before rounding to cents; compare within 0.000001 relative tolerance."
  ],
  "cases": [
    {
      "id": "card-typical",
      "description": "Credit card balance at a typical card APR",
      "input": {
        "balance": 5000,
        "apr": 22.99,
        "payment": 200
      },
      "expected": {
        "months": 35,
        "totalPaid": 6871.077685,
        "totalInterest": 1871.077685
      }
    },
    {
      "id": "card-extra",
      "description": "The same card with $50 a month extra",
      "input": {
        "balance": 5000,
        "apr": 22.99,
        "payment": 250
      },
      "expected": {
        "months": 26,
        "totalPaid": 6365.574323,
        "totalInterest": 1365.574323
      }
    },
    {
      "id": "card-minimum-like",
      "description": "A payment barely above the first month's interest",
      "input": {
        "balance": 5000,
        "apr": 22.99,
        "payment": 100
      },
      "expected": {
        "months": 167,
        "totalPaid": 16694.380176,
        "totalInterest": 11694.380176
      }
    },
    {
      "id": "auto-loan",
      "description": "Auto-loan-sized balance",
      "input": {
        "balance": 25000,
        "apr": 7.5,
        "payment": 500
      },
      "expected": {
        "months": 61,
        "totalPaid": 30069.237592,
        "totalInterest": 5069.237592
      }
    },
    {
      "id": "student-loan",
      "description": "Student-loan-sized balance",
      "input": {
        "balance": 30000,
        "apr": 5.5,
        "payment": 325
      },
      "expected": {
        "months": 121,
        "totalPaid": 39092.751565,
        "totalInterest": 9092.751565
      }
    },
    {
      "id": "zero-rate",
      "description": "Interest-free balance",
      "input": {
        "balance": 1200,
        "apr": 0,
        "payment": 100
      },
      "expected": {
        "months": 12,
        "totalPaid": 1200,
        "totalInterest": 0
      }
    },
    {
      "id": "one-payment",
      "description": "A payment larger than the balance",
      "input": {
        "balance": 400,
        "apr": 18,
        "payment": 1000
      },
      "expected": {
        "months": 1,
        "totalPaid": 406,
        "totalInterest": 6
      }
    }
  ]
}
