{
  "schemaVersion": 1,
  "slug": "final-grade-calculator",
  "category": "productivity",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "8f778cef1e64a3ac7e8b8e454e3b103b80ae7dd50b58e4b12e4bfd82818ead11",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/final-grade-calculator.json",
    "src/engine.js"
  ],
  "runtimeSource": "/sources/engine.txt",
  "runtimeHash": "5c888d8898afbdee36267bb9977829e1e2ac568f6677c8ee87469c139864645c",
  "scope": "The compute function records implemented equations, constants, lookup tables and custom rules. Inputs record defaults and allowed values; outputs record precision and units. Defaults are examples, not recommendations. General background references are not evidence for this specific algorithm.",
  "publishedFormula": {
    "formula": "F = (T − G × (1 − w)) ÷ w, w = W ÷ 100",
    "vars": [
      [
        "G",
        "current grade"
      ],
      [
        "T",
        "target grade"
      ],
      [
        "W",
        "final exam weight (%)"
      ],
      [
        "w",
        "weight as fraction"
      ],
      [
        "F",
        "required final score"
      ]
    ],
    "note": "w = final exam weight; required score = max(0, (target − current grade × (1 − w) − extra-credit points) ÷ w). Extra credit is added as overall course percentage points."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-12",
    "sources": [
      {
        "name": "OpenStax — Percent and weighted arithmetic",
        "url": "https://openstax.org/books/prealgebra-2e/pages/6-1-understand-percent"
      }
    ],
    "referenceRole": "definition",
    "implementationHash": "8f778cef1e64a3ac7e8b8e454e3b103b80ae7dd50b58e4b12e4bfd82818ead11",
    "basis": "F = (T − G × (1 − w)) ÷ w, w = W ÷ 100",
    "limitations": "The references explain definitions and methods; any extra preset must be checked against the assumptions on this page."
  },
  "contract": {
    "compute": "const w=finalWeight/100,raw=(targetGrade-currentGrade*(1-w)-extraCredit)/w,requiredScore=Math.max(0,raw),maxPossible=currentGrade*(1-w)+100*w+extraCredit,minPossible=currentGrade*(1-w),achievable=raw<=100;return {requiredScore,achievable:achievable?(raw<=0?'Already secured — even a zero would do it':'Yes, within reach'):'Not reachable — the target is above 100%',maxPossible,minPossible,neededPoints:Math.max(0,targetGrade-currentGrade)};",
    "inputs": [
      {
        "name": "currentGrade",
        "type": "number",
        "default": 82,
        "min": 0,
        "max": 100,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "targetGrade",
        "type": "number",
        "default": 90,
        "min": 0,
        "max": 100,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "finalWeight",
        "type": "number",
        "default": 30,
        "min": 1,
        "max": 100,
        "step": 1,
        "slider": true
      },
      {
        "name": "extraCredit",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 30,
        "step": 1,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "requiredScore",
        "precision": 2,
        "unit": "%"
      },
      {
        "name": "achievable",
        "precision": 0,
        "unit": "",
        "type": "text"
      },
      {
        "name": "maxPossible",
        "precision": 2,
        "unit": "%"
      },
      {
        "name": "minPossible",
        "precision": 2,
        "unit": "%"
      },
      {
        "name": "neededPoints",
        "precision": 2,
        "unit": "%"
      }
    ],
    "interpret": null
  }
}
