Skip to content

Money pattern #1305

@iluwatar

Description

@iluwatar

Description

The Money design pattern, as described by Martin Fowler, provides a way to encapsulate monetary values and their associated currencies. This pattern helps in handling calculations and operations involving money in a clear and reliable manner, avoiding common issues like rounding errors and ensuring currency consistency.

Key Elements of the Money Pattern:

  • Encapsulation of a monetary value along with its currency.
  • Operations involving monetary values, such as addition, subtraction, and multiplication, which consider the currency.
  • Proper handling of rounding issues.
  • Conversion between different currencies using an exchange rate.

References

Acceptance Criteria

  1. Create a Money class that encapsulates a monetary value and its associated currency.
  2. Implement operations (addition, subtraction, multiplication) on the Money class that handle currency consistency and rounding issues.
  3. Add functionality for currency conversion with appropriate handling of exchange rates.

Metadata

Metadata

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions