コード例 #1
0
 // method to instantiate a new thread to process the order
 public static void processOrder(OrderClass order, double unitPrice)
 {
     if (validateCreditCard(order.getCardNo()))                                     //checking the validity of the credit card
     {
         double tax         = unitPrice * order.getAmount() * TaxPercentage;        //tax=unitprice * orderamount * 0.06
         double totalCharge = unitPrice * order.getAmount() + tax + LocationCharge; //totalcharge=unitprice * orderamount + tax + locationcharge
         orderProcessed(order.getSenderId(), Convert.ToInt32(totalCharge), unitPrice, order.getAmount());
     }
     else
     {
         Console.WriteLine("Invalid credit card number");
     }
 }
コード例 #2
0
ファイル: Park.cs プロジェクト: Lokeshwar0304/445
        //method to receive an OrderObject from the MultiCellBuffer
        public void runOrderFunc()
        {
            OrderClass order = Program.multiCellBuffer.getOneCell(); //to fetch an order from MultiCellBuffer

            Console.WriteLine("creating a new orderProcessing thread to process {0} order for {1} tickets for the price ${2}", order.getSenderId(), order.getAmount(), getcurrent_price());
            Thread threadObj = new Thread(() => OrderProcessing.processOrder(order, getcurrent_price())); //creating a new orderProcessing thread to process the order

            threadObj.Start();                                                                            // start the thread to process the request
        }