Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

Car sales tax in five US states, as pure functions (and the rules that look alike but aren't)

Описание и применение

Модульный калькулятор стоимости покупки автомобиля, учитывающий различные правила налогообложения в пяти штатах США, реализованный как отдельные чистые функции с параметрами в JSON.

Задача

Designing a calculator for total car purchase cost that correctly handles diverse state tax rules.

Результат

A modular, testable calculator that accurately reflects each state’s tax rules.

Рабочий процесс

  • Read statutes to identify tax bases, local rates, fee shapes, and flat taxes.
  • Define a small pure function per state with a common signature.
  • Store state‑specific parameters in JSON alongside source citations.
  • Write tests from hand‑worked examples.
  • Use the functions to generate line items for UI.
  • Maintain readability and extensibility.

Доказательства

Reading the statutes first made it clear that one formula with a few parameters per state wouldn't hold up: the states differ in what they tax, which local rate applies and how fees are shaped.

Источник

One function per state stays readable.

Источник

  • Дата записи: 2026-11-02T02:43:54.061Z