{
  "schemaVersion": 1,
  "slug": "cruise-cost-calculator",
  "category": "travel",
  "kind": "implementation",
  "independentValidation": false,
  "implementationHash": "61e79eaed69fc5564f51a6dacd8be6c505b754ae36d4109480abccd33074eab8",
  "provenance": "Generated from the calculation contract used by the published page. Publication is not external validation.",
  "sourceFiles": [
    "data/calculators/cruise-cost-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 = f × n × p + u × (n + 1) × p + e × p + k",
    "vars": [
      [
        "f",
        "Fare per person per night"
      ],
      [
        "n",
        "Nights"
      ],
      [
        "p",
        "Passengers"
      ],
      [
        "u",
        "Gratuity + drinks per person per day"
      ],
      [
        "e",
        "Excursions per person"
      ],
      [
        "k",
        "Specialty dining + flights (group total)"
      ],
      [
        "T",
        "Estimated total (USD)"
      ]
    ],
    "note": "Daily gratuities and drinks use n + 1 calendar days as an explicit model assumption. Specialty dining and flights are group totals; all money values are USD. Check the cruise line’s fare inclusions and billing rules."
  },
  "externalEvidence": null,
  "contract": {
    "compute": "const cruiseFare = farePerPersonNight*nights*passengers; const gratuities = gratuityPerPersonDay*(nights+1)*passengers; const onboard = drinksPerPersonDay*(nights+1)*passengers+specialityDining; const excursions = excursionsPerPerson*passengers; const onboardTotal = gratuities+onboard+excursions+flights; return { cruiseFare, gratuities, onboard, excursions, onboardTotal, total: cruiseFare+onboardTotal, perPersonPerDay: (cruiseFare+onboardTotal)/(nights*passengers) };",
    "inputs": [
      {
        "name": "nights",
        "type": "number",
        "default": 7,
        "min": 1,
        "max": 200,
        "step": 1,
        "slider": true
      },
      {
        "name": "passengers",
        "type": "number",
        "default": 2,
        "min": 1,
        "max": 20,
        "step": 1,
        "slider": true
      },
      {
        "name": "farePerPersonNight",
        "type": "number",
        "default": 120,
        "min": 0,
        "max": 5000,
        "step": 5,
        "slider": true
      },
      {
        "name": "gratuityPerPersonDay",
        "type": "number",
        "default": 18,
        "min": 0,
        "max": 100,
        "step": 1,
        "slider": true
      },
      {
        "name": "drinksPerPersonDay",
        "type": "number",
        "default": 45,
        "min": 0,
        "max": 500,
        "step": 5,
        "slider": true
      },
      {
        "name": "excursionsPerPerson",
        "type": "number",
        "default": 250,
        "min": 0,
        "max": 5000,
        "step": 10,
        "slider": true
      },
      {
        "name": "specialityDining",
        "type": "number",
        "default": 0,
        "min": 0,
        "max": 5000,
        "step": 10,
        "slider": true
      },
      {
        "name": "flights",
        "type": "number",
        "default": 500,
        "min": 0,
        "max": 20000,
        "step": 25,
        "slider": true
      }
    ],
    "outputs": [
      {
        "name": "total",
        "precision": 2,
        "unit": "USD"
      },
      {
        "name": "cruiseFare",
        "precision": 2,
        "unit": "USD"
      },
      {
        "name": "gratuities",
        "precision": 2,
        "unit": "USD"
      },
      {
        "name": "onboard",
        "precision": 2,
        "unit": "USD"
      },
      {
        "name": "excursions",
        "precision": 2,
        "unit": "USD"
      },
      {
        "name": "onboardTotal",
        "precision": 2,
        "unit": "USD"
      },
      {
        "name": "perPersonPerDay",
        "precision": 2,
        "unit": "USD"
      }
    ],
    "interpret": null
  }
}
