{
  "schemaVersion": 1,
  "slug": "lawn-fertilizer-calculator",
  "category": "gardening",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "cbfda3bc290185b548815e29cd149e9d3da60836e74ada04e34e20b190210137",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/lawn-fertilizer-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": "N=A÷1000×r; P=N÷(n÷100); bags=ceil(P÷w); cost=bags×price",
    "vars": [
      [
        "A",
        "lawn area (sq ft)"
      ],
      [
        "r",
        "user-entered N target (lb/1,000 sq ft)"
      ],
      [
        "n",
        "label N percentage"
      ],
      [
        "N",
        "nitrogen needed (lb)"
      ],
      [
        "P",
        "product needed (lb)"
      ],
      [
        "w",
        "bag weight (lb)"
      ]
    ],
    "note": "The estimate charges for whole bags, not a prorated fraction. Use a soil test, local guidance and the fertilizer label to choose an application rate."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const nitrogenNeeded=area/1000*nPerThousand; if(nPercent<=0)return{nitrogenNeeded,productNeeded:null,bags:null,cost:null,spreadRate:null,__error:\"inputError\"}; const productNeeded=nitrogenNeeded/(nPercent/100); return {nitrogenNeeded,productNeeded,bags:Math.ceil(productNeeded/(bagWeight||40)),cost:Math.ceil(productNeeded/(bagWeight||40))*pricePerBag,spreadRate:productNeeded/(area/1000)};",
    "inputs": [
      {
        "name": "area",
        "type": "number",
        "default": 5000,
        "min": 10,
        "max": 500000,
        "step": 10
      },
      {
        "name": "nPerThousand",
        "type": "number",
        "default": 0.75,
        "min": 0.1,
        "max": 2,
        "step": 0.05,
        "slider": true
      },
      {
        "name": "nPercent",
        "type": "number",
        "default": 24,
        "min": 0,
        "max": 46,
        "step": 1,
        "slider": true
      },
      {
        "name": "bagWeight",
        "type": "number",
        "default": 40,
        "min": 5,
        "max": 100,
        "step": 5,
        "slider": true
      },
      {
        "name": "pricePerBag",
        "type": "number",
        "default": 45,
        "min": 0,
        "max": 500,
        "step": 1,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "nitrogenNeeded",
        "precision": 2,
        "unit": "lb"
      },
      {
        "name": "productNeeded",
        "precision": 1,
        "unit": "lb"
      },
      {
        "name": "bags",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "cost",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "spreadRate",
        "precision": 2,
        "unit": "lb per 1,000 sq ft"
      }
    ],
    "interpret": null
  }
}
