{
  "address": "635d6a00d75d2ab303e734b8f00bca4e",
  "category": "other",
  "question": "Package A costs 4.99 for 16 units and package B costs 7.99 for 32 units. Which is cheaper per unit?",
  "answer": "Package A: 0.3119 per unit; Package B: 0.2497 per unit; package B is cheaper per unit.",
  "askedBy": {
    "kind": "guest",
    "display": "method deck",
    "stamped": false,
    "id": null
  },
  "answeredBy": "method",
  "madeAt": "2026-09-30T22:39:30.722Z",
  "validUntil": null,
  "validityClass": "forever",
  "sources": [
    {
      "label": "Saving Money with Unit Pricing",
      "url": "https://portal.ct.gov/dcp/common-elements/publications/saving-money-with-unit-pricing"
    }
  ],
  "supersedes": null,
  "supersededBy": null,
  "isSeed": false,
  "seedSource": null,
  "seedAttribution": null,
  "duplicateOfQid": null,
  "publishedAt": null,
  "unpublishedAt": null,
  "voteCount": 0,
  "queuedForSubstrate": false,
  "answerMethod": "method",
  "unsourced": false,
  "source": {
    "kind": "url",
    "value": "https://portal.ct.gov/dcp/common-elements/publications/saving-money-with-unit-pricing",
    "retrieved_utc": "2026-09-30T22:29:13Z"
  },
  "qsha256": "b141fd0dfd463e1af30f10be7eef81c94a270ac026a51e951086d776567a6884",
  "runOne": null,
  "cardContractVersion": "card_contract/1",
  "deck_id": "method-deck",
  "deck_title": "Method Deck",
  "method": {
    "name": "Unit price comparison",
    "version": "1",
    "source_url_or_file": "methods/unit-price-comparison.cjs",
    "sha256_of_method_file": "9277983fded630dc6731b8624bb10e5fe9d6cc6d8e215163b678c710ce1a2fab"
  },
  "receipt": {
    "inSubstrate": false,
    "local": true,
    "modelCallsAtMint": 0,
    "tokensAtMint": 0
  },
  "method_deck": {
    "inputs": [
      {
        "name": "price_a",
        "type": "number",
        "required": true,
        "description": "Total price of package A",
        "min": 0
      },
      {
        "name": "quantity_a",
        "type": "number",
        "required": true,
        "description": "Quantity (in a common unit, e.g. oz or count) of package A",
        "min": 0
      },
      {
        "name": "price_b",
        "type": "number",
        "required": true,
        "description": "Total price of package B",
        "min": 0
      },
      {
        "name": "quantity_b",
        "type": "number",
        "required": true,
        "description": "Quantity (in the same unit as quantity_a) of package B",
        "min": 0
      }
    ],
    "outputs": [
      {
        "name": "unit_price_a",
        "description": "price_a / quantity_a"
      },
      {
        "name": "unit_price_b",
        "description": "price_b / quantity_b"
      },
      {
        "name": "cheaper",
        "description": "\"A\", \"B\", or \"tie\""
      }
    ],
    "steps": [
      "Compute the unit price of package A: unit_price_a = price_a / quantity_a.",
      "Compute the unit price of package B: unit_price_b = price_b / quantity_b.",
      "The package with the lower unit price is the better value; equal unit prices are a tie.",
      "Round both unit prices to 4 decimal places (the conventional precision for per-unit shelf pricing)."
    ],
    "constants": [],
    "examples": [
      {
        "name": "worked example",
        "inputs": {
          "price_a": 4.99,
          "quantity_a": 16,
          "price_b": 7.99,
          "quantity_b": 32
        },
        "expected": {
          "answer": "Package A: 0.3119 per unit; Package B: 0.2497 per unit; package B is cheaper per unit."
        },
        "check": "By hand: 4.99/16 = 0.311875 -> 0.3119; 7.99/32 = 0.2496875 -> 0.2497. 0.2497 < 0.3119, so B is cheaper."
      },
      {
        "name": "test vector: A is cheaper",
        "inputs": {
          "price_a": 3,
          "quantity_a": 12,
          "price_b": 5,
          "quantity_b": 18
        },
        "expected": {
          "answer": "Package A: 0.2500 per unit; Package B: 0.2778 per unit; package A is cheaper per unit."
        },
        "check": "By hand: 3.00/12 = 0.25 exactly; 5.00/18 = 0.277778 -> 0.2778. 0.25 < 0.2778, so A is cheaper."
      },
      {
        "name": "test vector: tie",
        "inputs": {
          "price_a": 10,
          "quantity_a": 5,
          "price_b": 20,
          "quantity_b": 10
        },
        "expected": {
          "answer": "Package A: 2.0000 per unit; Package B: 2.0000 per unit; the two packages are the same price per unit."
        },
        "check": "By hand: 10/5 = 2 exactly and 20/10 = 2 exactly, so both unit prices are equal: a tie."
      }
    ],
    "disclaimer": null,
    "deck_category": "currency"
  },
  "status": "minted",
  "kind": "method",
  "provenanceClass": "own_question",
  "provenance": {
    "schema": "card_provenance/2.0.0",
    "chain": [
      {
        "source": {
          "kind": "url",
          "value": "https://portal.ct.gov/dcp/common-elements/publications/saving-money-with-unit-pricing",
          "retrieved_utc": "2026-09-30T22:29:13Z"
        },
        "sha256": "8df696fb7e4e6a2df82f97a3f77a11de51a963ba32838835c8ee98183e05f0c9",
        "supersedes": null,
        "added_utc": "2026-09-30T22:39:30.722Z",
        "added_by": "method:Unit price comparison",
        "why": "the method that computed this answer",
        "check": null,
        "status_label": "pending",
        "signature": null
      }
    ]
  }
}
