{
  "schemaVersion": 1,
  "slug": "birthday-party-budget-calculator",
  "category": "party",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "171659d76bb1b3113817190b93a4313721ddd718d36b7d3dd98812d85fe3f018",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/birthday-party-budget-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": "T = n·(f + s·c + a) + D + V; perGuest = T/n",
    "vars": [
      [
        "n",
        "Number of guests"
      ],
      [
        "f",
        "Food cost per guest"
      ],
      [
        "s",
        "Cake servings per guest"
      ],
      [
        "c",
        "Cost per cake serving"
      ],
      [
        "a",
        "Favor cost per guest"
      ],
      [
        "D",
        "Decor fixed cost"
      ],
      [
        "V",
        "Venue fixed cost"
      ],
      [
        "perGuest",
        "Average cost per guest"
      ]
    ],
    "note": "Cake servings are rounded up to a whole number; T is the total budget and perGuest the average cost per attendee."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const food = guests*foodPerGuest; const servings = guests*cakeServingsPerGuest; const cake = servings*cakeCostPerServing; const favors = guests*favorsPerGuest; const fixed = decorCost + venueCost; const total = food + cake + favors + fixed; return { foodCost: food, cakeCost: cake, favorCost: favors, fixedCost: fixed, total: total, perGuest: guests > 0 ? total/guests : 0, cakeServings: Math.ceil(servings) };",
    "inputs": [
      {
        "name": "guests",
        "type": "number",
        "default": 20,
        "min": 1,
        "max": 500,
        "step": 1,
        "slider": true
      },
      {
        "name": "foodPerGuest",
        "type": "number",
        "default": 8,
        "min": 0,
        "max": 500,
        "step": 0.01
      },
      {
        "name": "cakeServingsPerGuest",
        "type": "number",
        "default": 1.2,
        "min": 0,
        "max": 5,
        "step": 0.1,
        "slider": true
      },
      {
        "name": "cakeCostPerServing",
        "type": "number",
        "default": 4,
        "min": 0,
        "max": 100,
        "step": 0.01
      },
      {
        "name": "decorCost",
        "type": "number",
        "default": 60,
        "min": 0,
        "max": 100000,
        "step": 1
      },
      {
        "name": "venueCost",
        "type": "number",
        "default": 250,
        "min": 0,
        "max": 1000000,
        "step": 1
      },
      {
        "name": "favorsPerGuest",
        "type": "number",
        "default": 3,
        "min": 0,
        "max": 500,
        "step": 0.01
      }
    ],
    "outputs": [
      {
        "name": "foodCost",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "cakeCost",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "favorCost",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "fixedCost",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "total",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "perGuest",
        "precision": 2,
        "unit": "$"
      },
      {
        "name": "cakeServings",
        "precision": 0,
        "unit": ""
      }
    ],
    "interpret": null
  }
}
