KatInterview

Annual Profit and Break-Even Value for a Lounge Menu Item

Math & Bit ManipulationAuto-graded · 19 test cases
EasyAuto-gradedMath & Bit Manipulationarithmeticbreak-evensimulation

Last updated

Compute a per-site annual operating result and the break-even per-unit benefit from visit volume, uptake rate, unit cost, unit benefit, a one-time setup cost, and a time horizon.

Menu Item Economics for One Lounge

A travel-card issuer is piloting a new made-to-order menu item in an airport lounge. For a single lounge, you know the visitor traffic, the share of visitors who order the item, what each serving costs, how much retention benefit each serving is worth, and a one-time equipment cost.

Write a function that returns two figures for one lounge:

  1. Annual operating profit: the yearly net result of serving the item, ignoring the one-time setup cost.
  2. Break-even benefit per serving: the per-serving benefit that would make total benefit over the whole horizon exactly cover both the variable costs and the one-time setup cost.

Inputs

  • annual_visits (int): eligible visits to the lounge per year.
  • take_rate (float): fraction of visits that result in one serving being ordered.
  • variable_cost_per_burger (float): cost of producing one serving.
  • retention_value_per_burger (float): benefit credited for each serving.
  • fixed_setup_cost (float): one-time setup cost for the lounge.
  • horizon_years (int): number of years over which the break-even is evaluated.

Definitions

  • Servings per year = annual_visits * take_rate (do not round; keep it as a real number).

  • Annual operating profit = servings per year × (retention_value_per_burger − variable_cost_per_burger).

  • Break-even benefit per serving = variable_cost_per_burger + fixed_setup_cost / (servings per year × horizon_years).

    This is the benefit at which total benefit across the horizon equals total variable cost plus the setup cost, assuming volume is the same each year.

Edge cases

  • If servings per year is 0, or horizon_years is 0, the break-even value is undefined and must be returned as None.

Output

Return a dictionary with exactly two keys:

  • "annual_operating_profit": a float.
  • "break_even_retention_value_per_burger": a float, or None in the undefined case above.

Constraints

  • annual_visits >= 0, horizon_years >= 0.
  • 0 <= take_rate <= 1.
  • Costs and values are non-negative real numbers.
  • No rounding is required; return the plain computed values.

Examples

Example 1

Input: lounge_item_economics(150000, 0.4, 4.5, 3, 120000, 2)

Output: {'annual_operating_profit': -90000, 'break_even_retention_value_per_burger': 5.5}

Example 2

Input: lounge_item_economics(100000, 0.25, 5, 8, 120000, 2)

Output: {'annual_operating_profit': 75000, 'break_even_retention_value_per_burger': 7.4}

Example 3

Input: lounge_item_economics(200000, 0.5, 3.75, 3.75, 100000, 2)

Output: {'annual_operating_profit': 0, 'break_even_retention_value_per_burger': 4.25}

Hints

Hint 1

Start by computing the number of servings per year: visits multiplied by the take rate.

Hint 2

Annual profit is servings times the per-serving margin (benefit minus variable cost); the setup cost is not part of it.

Hint 3

For break-even, spread the setup cost across all servings over the horizon and add it to the variable cost per serving. Guard against dividing by zero when there are no servings or no horizon.