public MonetaryValue dividedBy(decimal dividend) { if (dividend == 0) { return(MonetaryValue.of(this.Code, 0)); } return(MonetaryValue.of(this.Code, this.PreciseValue / dividend)); }
public MonetaryValue subtractValueOf(MonetaryValue other, IDictionary <string, decimal> table = null) { if ((this.Code != other.Code)) { if (table is null) { throw new Exception("Can't subtract MonetaryValue, convertion table is null"); } var other_converted = other.PreciseValue * table[other.Code]; return(MonetaryValue.of(this.Code, this.PreciseValue - other_converted)); } return(MonetaryValue.of(this.Code, this.PreciseValue - other.PreciseValue)); }
public MonetaryValue multipliedBy(decimal multiple) { return(MonetaryValue.of(this.Code, this.PreciseValue * multiple)); }