private int validateCredit() {
			try {
				String cardnumber;
				Date expire;

				mvb.updateStatusBar("Validating Credit Card...");
				
				if (cardNo.getText().trim().length() != 0
						&& cardNo.getText().trim().length() == 16
						&& isNumeric(cardNo.getText().trim())) {
					cardnumber = cardNo.getText().trim();
				} else {
					return VALIDATIONERROR;
				}

				String stringDate = cardExp.getText().trim();

				if (stringDate.length() != 0) {
					if (stringDate.length() != 5)
						return VALIDATIONERROR;
					SimpleDateFormat fm = new SimpleDateFormat("MM/yy");
					java.util.Date utilDate;
					try {
						utilDate = fm.parse(stringDate);
					} catch (ParseException ex) {
						return VALIDATIONERROR;
					}
					expire = new java.sql.Date(utilDate.getTime());
				} else {
					return VALIDATIONERROR;
				}
				
				if(clerk.updateCreditCard(rid, cardnumber, expire) == 0){
					mvb.updateStatusBar("Validate Failed");
					return OPERATIONFAILED;
				}
				
				mvb.updateStatusBar("Checkout complete.");
				
				//formatting to print receiptID and date of purchase in status bar
				ResultSet rdate = clerk.receiptDate(rid);
				rdate.next();
				Date recdate = rdate.getDate(1);
				SimpleDateFormat rdformat = new SimpleDateFormat("DD-MM-YYYY");
				String strdate = rdformat.format(recdate);
				mvb.updateStatusBar("Receipt# : " + rid.toString() + " Date: " + strdate);

				showItems(); // show purchased items in a table
				
				String lastfive = cardnumber.substring(cardnumber.length() - 6, cardnumber.length() - 1);
				mvb.updateStatusBar("Credit card# : XXXX XXXX XXXX " + lastfive);
				cost = clerk.receiptTotal(rid);
				mvb.updateStatusBar("Your total cost is: $" + cost.toString());
				rid = null; // clear rid for next Purchase process
				cost = null; // clear cost for next Purchase process
				return OPERATIONSUCCESS;

			// this exception is thrown when a string cannot be converted to a number
			} catch (NumberFormatException ex) {
				return VALIDATIONERROR;
			// this exception is thrown when an error occurs in any SQL query when
			// clerk.receiptDate is called.
			} catch (SQLException ex) {
				return VALIDATIONERROR;
			}
		}