{
  "schemaVersion": 1,
  "slug": "hotel-comparison-calculator",
  "category": "travel",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "8fa6166baa6151b51c37d4caaf2d391cd46c0636f37ddddc913d6a34f3101377",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/hotel-comparison-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": "CA = RA × n ; CB = RB × n ; CA* = CA + m ÷ 60 × v × n ; Δ = CB − CA*",
    "vars": [
      [
        "RA",
        "Hotel A nightly cost (rate + extras + travel)"
      ],
      [
        "RB",
        "Hotel B nightly cost (rate + extras + travel)"
      ],
      [
        "n",
        "number of nights"
      ],
      [
        "m",
        "Hotel A extra travel time (minutes per night)"
      ],
      [
        "v",
        "value of travel time ($/hour)"
      ],
      [
        "Δ",
        "cost difference B − true A"
      ]
    ],
    "note": "All values are USD. Hotel A time cost = extra minutes per day ÷ 60 × user-entered USD/hour value × nights. This compares only entered costs; time value is subjective."
  },
  "externalEvidence": {
    "reviewedAt": "2026-10-12",
    "sources": [
      {
        "name": "CFPB — Budget worksheet and expense inputs",
        "url": "https://www.consumerfinance.gov/consumer-tools/educator-tools/your-money-your-goals/toolkit/"
      }
    ],
    "referenceRole": "input",
    "implementationHash": "8fa6166baa6151b51c37d4caaf2d391cd46c0636f37ddddc913d6a34f3101377",
    "basis": "CA = RA × n ; CB = RB × n ; CA* = CA + m ÷ 60 × v × n ; Δ = CB − CA*",
    "limitations": "Use the cited guidance and your own measurements, bills or product specifications to choose inputs. Sample defaults are not current local data."
  },
  "contract": {
    "compute": "const costA = (rateA+extrasA)*nights+travelA*nights; const costB = (rateB+extrasB)*nights+travelB*nights; const timeCostA = extraTravelMinutes/60*timeValuePerHour*nights; const trueCostA = costA+timeCostA; const difference = costB-trueCostA; const recommendation = Math.abs(difference) < 0.005 ? 'Hotel costs are about equal in this model' : difference > 0 ? 'Hotel A is cheaper by $'+Math.round(difference)+' once travel time is valued' : 'Hotel B is cheaper by $'+Math.round(-difference)+' even after the higher rate'; return { costA, costB, timeCostA, trueCostA, difference, recommendation };",
    "inputs": [
      {
        "name": "rateA",
        "type": "number",
        "default": 150,
        "min": 0,
        "max": 10000,
        "step": 5,
        "slider": true
      },
      {
        "name": "extrasA",
        "type": "number",
        "default": 30,
        "min": 0,
        "max": 1000,
        "step": 5,
        "slider": true
      },
      {
        "name": "travelA",
        "type": "number",
        "default": 35,
        "min": 0,
        "max": 500,
        "step": 1,
        "slider": true
      },
      {
        "name": "rateB",
        "type": "number",
        "default": 210,
        "min": 0,
        "max": 10000,
        "step": 5,
        "slider": true
      },
      {
        "name": "extrasB",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 1000,
        "step": 5,
        "slider": true
      },
      {
        "name": "travelB",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 500,
        "step": 1,
        "slider": true
      },
      {
        "name": "nights",
        "type": "number",
        "default": 4,
        "min": 1,
        "max": 365,
        "step": 1,
        "slider": true
      },
      {
        "name": "timeValuePerHour",
        "type": "number",
        "default": 25,
        "min": 0,
        "max": 500,
        "step": 5,
        "slider": true,
        "advanced": true
      },
      {
        "name": "extraTravelMinutes",
        "type": "number",
        "default": 40,
        "min": 0,
        "max": 240,
        "step": 5,
        "slider": true,
        "advanced": true
      }
    ],
    "outputs": [
      {
        "name": "costA",
        "precision": 0,
        "unit": "USD"
      },
      {
        "name": "costB",
        "precision": 0,
        "unit": "USD"
      },
      {
        "name": "timeCostA",
        "precision": 0,
        "unit": "USD"
      },
      {
        "name": "trueCostA",
        "precision": 0,
        "unit": "USD"
      },
      {
        "name": "difference",
        "precision": 0,
        "unit": "USD"
      },
      {
        "name": "recommendation",
        "precision": 0,
        "unit": "",
        "type": "text"
      }
    ],
    "interpret": null
  }
}
