Пример #1
0
 public static void processOrder(Order order)
 {
     // Calculate order price
     Int32 subtotal, total, tax, shipping;
     subtotal = order.getUnitPrice() * order.getAmount();
     tax = (Int32)(subtotal * TAXRATE);
     shipping = order.getAmount() * SHIPPINGRATE;
     total = subtotal + tax + shipping;
 }
Пример #2
0
        public static void processOrder(Order order)
        {
            // Calculate order price
            Int32 subtotal, total, tax, shipping;

            subtotal = order.getUnitPrice() * order.getAmount();
            tax      = (Int32)(subtotal * TAXRATE);
            shipping = order.getAmount() * SHIPPINGRATE;
            total    = subtotal + tax + shipping;
        }
Пример #3
0
        public void orderProcessing()
        {
            float tax, shipping;
            Int32 subtotal, total;

            if (pOrder.getAmount() <= (ChickenFarm.getNumChickens() - 2))
            {
                if ((pOrder.getCardNum() > 999) && (pOrder.getCardNum() < 10000))
                {
                    subtotal = pOrder.getUnitPrice() * pOrder.getAmount();
                    tax      = subtotal * TAXRATE;
                    shipping = pOrder.getAmount() * SHIPPINGRATE;
                    total    = (Int32)(subtotal + tax + shipping);
                    ChickenFarm.setNumChickens(ChickenFarm.getNumChickens() - pOrder.getAmount());

                    // Order finished timestamp
                    DateTime endTime = DateTime.Now.ToUniversalTime();
                    TimeSpan span    = endTime.Subtract(pOrder.getStartTime());

                    //send receipt (output to console)
                    Console.Out.WriteLine("Retailer {0} bought {1} chickens for a total of ${2} at price {3} in {4}ms!", pOrder.getThreadId(), pOrder.getAmount(), total, pOrder.getUnitPrice(), span.TotalMilliseconds);
                }
            }
        }