{
  "schemaVersion": 1,
  "slug": "flooring-calculator",
  "category": "household",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "2a8e96781ea4958977afe177e0e1607c7d2ad67f3ef84a0d804669f16411afe2",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/flooring-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": "B = ceil(L × W × (1 + w ÷ 100) ÷ c)",
    "vars": [
      [
        "L",
        "floor length"
      ],
      [
        "W",
        "floor width"
      ],
      [
        "w",
        "waste percentage"
      ],
      [
        "c",
        "coverage per box"
      ],
      [
        "B",
        "boxes needed"
      ]
    ],
    "note": "Boxes = ceil(room area × (1 + chosen waste %) ÷ box coverage). Dimensions and coverage use ft²; cost = boxes × entered price. Waste is user-selected, not an automatic rule by product or layout."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "if(!(length>0&&width>0&&coverage>0))return {__error:'inputError'};const area=length*width,totalArea=area*(1+waste/100),boxes=Math.ceil(totalArea/coverage);return {area,totalArea,boxes,totalCost:boxes*pricePerBox};",
    "inputs": [
      {
        "name": "length",
        "type": "number",
        "default": 14,
        "min": 0.5,
        "max": 500,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "width",
        "type": "number",
        "default": 12,
        "min": 0.5,
        "max": 500,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "waste",
        "type": "number",
        "default": 10,
        "min": 0,
        "max": 40,
        "step": 1,
        "slider": true
      },
      {
        "name": "coverage",
        "type": "number",
        "default": 24,
        "min": 1,
        "max": 1000,
        "step": 0.5,
        "slider": true
      },
      {
        "name": "pricePerBox",
        "type": "number",
        "default": 45,
        "min": 0,
        "max": 1000,
        "step": 1,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "area",
        "precision": 1,
        "unit": "sq ft"
      },
      {
        "name": "totalArea",
        "precision": 1,
        "unit": "sq ft"
      },
      {
        "name": "boxes",
        "precision": 0,
        "unit": ""
      },
      {
        "name": "totalCost",
        "precision": 2,
        "unit": "$"
      }
    ],
    "interpret": null
  }
}
