{
  "schemaVersion": 1,
  "slug": "toilet-paper-calculator",
  "category": "household",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "4b1ad82702f960db3623c90df3c50f82a9e512872b37b3271e3d95d13a9178ca",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/toilet-paper-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": "R = p × s × 30.44 ÷ q; C = 12 × R × c",
    "vars": [
      [
        "R",
        "Rolls per month"
      ],
      [
        "p",
        "People"
      ],
      [
        "s",
        "Sheets per person per day"
      ],
      [
        "q",
        "Sheets per roll"
      ],
      [
        "c",
        "Price per roll"
      ],
      [
        "C",
        "Yearly cost"
      ]
    ],
    "note": "Daily sheets = people × sheets per person. Monthly rolls = daily sheets × 30.44 ÷ sheets per roll. Annual rolls = ceiling(monthly rolls × 12); yearly cost = whole annual rolls × price per roll. The user-entered daily use is an assumption."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const perDay=people*sheetsPerPersonDay; const rollsPerMonth=perDay*30.44/sheetsPerRoll; const rollsPerYear=Math.ceil(rollsPerMonth*12); return { rollsPerMonth, rollsPerYear, yearlyCost: rollsPerYear*pricePerRoll, costPerSheet: pricePerRoll/sheetsPerRoll };",
    "inputs": [
      {
        "name": "people",
        "type": "number",
        "default": 4,
        "min": 1,
        "max": 20,
        "step": 1,
        "slider": true
      },
      {
        "name": "sheetsPerPersonDay",
        "type": "number",
        "default": 57,
        "min": 5,
        "max": 300,
        "step": 1,
        "slider": true
      },
      {
        "name": "sheetsPerRoll",
        "type": "number",
        "default": 200,
        "min": 20,
        "max": 2000,
        "step": 10,
        "slider": true
      },
      {
        "name": "pricePerRoll",
        "type": "number",
        "default": 0.9,
        "min": 0,
        "max": 20,
        "step": 0.05,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "rollsPerMonth",
        "precision": 1,
        "unit": "rolls"
      },
      {
        "name": "rollsPerYear",
        "precision": 0,
        "unit": "rolls"
      },
      {
        "name": "yearlyCost",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "costPerSheet",
        "precision": 4,
        "unit": "$"
      }
    ],
    "interpret": null
  }
}
