TaxBreakdown

// This is the sample C# code for the example .NET Objects in the Grid. See that page for more details.

using System;
using System.Collections.Generic;
using System.Text;

namespace TaxCalc
{
    public class TaxBreakdown
    {
        public double valueAddedTax = 0;
        public double valueSubtractedTax = 0;
        public double officeSuppliesLevy = 0;
        public double overpricedProductTax = 0;
        public double rInTheMonthTax = 0;

        public TaxBreakdown(string product, double price)
        {
            if ("Paper".Equals(product))
            {
                this.valueAddedTax = price * 0.05;
            }
            else
            {
                this.valueAddedTax = price * 0.175;
            }
            if ("Printer Ink".Equals(product))
            {
                this.valueAddedTax = price * 0.5;
            }
            else
            {
                this.valueAddedTax = price * 0.05;
            }
            this.officeSuppliesLevy = 0.25;
            if (price > 50)
            {
                this.overpricedProductTax = 0.1 * price;
            }
            else
            {
                this.overpricedProductTax = 0;
            }

            string month = DateTime.Now.ToString("MMMM");
            if (month.IndexOf('r') == -1 && month.IndexOf('R') == -1)
            {
                this.rInTheMonthTax = 0;
            }
            else
            {
                this.rInTheMonthTax = 0.05 * price;
            }
        }

        public override string ToString()
        {
            return "TaxBreakdown object";
        }

    }
}