Пример #1
0
        // method for calculate the total sales tax
        public double TotalSalesTax()
        {
            // calculate the total sales tax amount
            for (int i = 0; i < item.Length; i++)
            {
                tax = new Tax();
                tax.CalculateTax(item[i]);
                totaltax = totaltax + tax.TotalTaxAmount();
            }

            //return the rounded up to the nearest 0.05) amount of sales tax
            return Math.Ceiling(totaltax * 20) / 20;
        }
        // method for calculate the total sales tax
        public double TotalSalesTax()
        {
            // calculate the total sales tax amount
            for (int i = 0; i < item.Length; i++)
            {
                tax = new Tax();
                tax.CalculateTax(item[i]);
                totaltax = totaltax + tax.TotalTaxAmount();
            }

            //return the rounded up to the nearest 0.05) amount of sales tax
            return(Math.Ceiling(totaltax * 20) / 20);
        }
Пример #3
0
        // Calculate the Toal TaxItem Amount
        public Hashtable CaluculateToalTaxItemAmount()
        {
            //create hashtable for store the total amount and item name
            Hashtable h = new Hashtable(item.Length);

            for (int i = 0; i < item.Length; i++)
            {
                tax = new Tax(); // create object for each item
                tax.CalculateTax(item[i]); // calculate the tax
                tot = tax.TotalItemAmount(item[i].Price,item[i].NoOfItems);// get the total amount
                h.Add(item[i].Name, tot); // Add in Hashatable
            }

            return h; // return heash table
        }
        // Calculate the Toal TaxItem Amount
        public Hashtable CaluculateToalTaxItemAmount()
        {
            //create hashtable for store the total amount and item name
            Hashtable h = new Hashtable(item.Length);

            for (int i = 0; i < item.Length; i++)
            {
                tax = new Tax();                                             // create object for each item
                tax.CalculateTax(item[i]);                                   // calculate the tax
                tot = tax.TotalItemAmount(item[i].Price, item[i].NoOfItems); // get the total amount
                h.Add(item[i].Name, tot);                                    // Add in Hashatable
            }

            return(h); // return heash table
        }