Esempio n. 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;
        }
Esempio n. 2
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
        }
Esempio n. 3
0
 // public cons for init the SalesItems values
 public CalculateTax(SalesItems[] it)
 {
     tax = new Tax();
     item = it;
 }