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