Class Dividend
Defined in File dividend.hpp
Class Documentation
-
class Dividend
Represents a dividend with both fixed and proportional components.
The Dividend class models a dividend with a fixed amount and a proportional yield. It supports common arithmetic operations, equality checks, and formatting for output.
Public Functions
-
inline Dividend()
Default constructor that initializes the fixed and proportional components to zero.
-
inline Dividend(double fixed)
Constructor that initializes the fixed component and sets the proportional component to zero.
- Parameters:
fixed – The fixed component of the dividend.
-
inline Dividend(double fixed, double yield)
Constructor that initializes both fixed and proportional components of the dividend.
- Parameters:
fixed – The fixed component of the dividend.
yield – The proportional yield of the dividend.
-
inline bool operator==(const Dividend &other) const
Equality operator to compare two Dividend objects.
- Parameters:
other – The Dividend object to compare against.
- Returns:
True if both the fixed and proportional components are equal, otherwise false.
-
inline bool operator!=(const Dividend &other) const
Inequality operator to compare two Dividend objects.
-
inline bool equal(const Dividend &other, double epsilon) const
Checks if two Dividend objects are equal within a given epsilon tolerance.
-
inline Dividend &operator+=(const Dividend &rhs)
Addition assignment operator to add another Dividend to the current object.
-
inline double get_fixed() const
Gets the fixed component of the dividend.
- Returns:
The fixed component of the dividend.
-
inline void set_fixed(double fixed)
Sets the fixed component of the dividend.
- Parameters:
fixed – The fixed component to set.
-
inline double get_proportional() const
Gets the proportional component of the dividend.
- Returns:
The proportional component of the dividend.
-
inline void set_proportional(double proportional)
Sets the proportional component of the dividend.
- Parameters:
proportional – The proportional component to set.
Public Static Functions
-
inline Dividend()