Beispiel #1
0
 public double calculateDiscount(Order order)
 {
     if (order.getCount() >= 5)
     {
         int    times    = (int)order.getCount() / 5;
         double discount = 0;
         for (int i = 0; i < times; ++i)
         {
             discount += order[((i + 1) * 5) - 1].Commodity.Price / 2;
         }
         return(discount);
     }
     return(0);
 }
Beispiel #2
0
        public double calculateDiscount(Order order)
        {
            double discount = 0;

            for (int i = 0; i < order.getCount(); ++i)
            {
                if (order[i].Commodity.Price >= 700)
                {
                    discount += (order[i].Commodity.Price * 0.4) * order[i].Amount;
                }
            }
            return(discount);
        }