コード例 #1
0
        /// <summary>
        /// Adds one dollar amound to another dollar amount
        /// </summary>
        /// <param name="amountToAdd"></param>
        /// <returns>New Dollar Amount Value</returns>
        public DollarAmount Plus(DollarAmount amountToAdd)
        {
            int newTotal = this.totalAmountInCents + amountToAdd.totalAmountInCents;

            return(new DollarAmount(newTotal));
        }
コード例 #2
0
        /// <summary>
        /// Subtract one dollar amount from another dollar amount
        /// </summary>
        /// <param name="amountToSubtract"></param>
        /// <returns>New Dollar Amount Value</returns>
        public DollarAmount Minus(DollarAmount amountToSubtract)
        {
            int difference = this.totalAmountInCents - amountToSubtract.totalAmountInCents;

            return(new DollarAmount(difference));
        }