public void orderFunc(OrderObject order) { //start thread //check if card is valid int cardNo = order.getCardNum(); // check if airline matches receiver ID if (cardNo >= 5000 && cardNo <= 7000) { //card is valid, process order double orderTotal = order.getUnitPrice() * order.getAmount() * .081; //(unit price * amount of tickets * sales tax) //Program.rwlock.AcquireWriterLock(300); // try // { Program.confirm.setCell(order.getSenderID(), orderTotal); // place the confirmation in the confirmation buffer // } // finally // { // Program.rwlock.ReleaseWriterLock(); // } // Monitor.PulseAll(Program.confirm); } }
// static method that can be called anywhere to encrypt the object into a string value public static string encrypt(OrderObject oo) { // string encryption as follows: <senderID>/<card number>/<receiverID>/<amount of tickets>/<unit price string encrypted = oo.getSenderID() + "/" + oo.getCardNum() + "/" + oo.getReceiverID() + "/" + oo.getAmount() + "/" + oo.getUnitPrice(); return encrypted; }