Java Reference
In-Depth Information
if (command.equals(Const.GET_NAME)){
String result # market.getName(
Long.parseLong(param));
if (result ## null )
response # Const.ERROR ! " Item not found";
else
response # Const.OK ! " " ! result;
} else if (command.equals(Const.GET_PRICE)){
double result # market.getPrice(
Long.parseLong(param));
if (result < 0 )
response # Const.ERROR ! " Item not found";
else
response # Const.OK ! " " ! result;
} else if (command.equals(Const.GET_CUSTOMER)){
customer # Long.parseLong(param);
String result # market.getCustomer(customer);
if (result ## null )
response # Const.ERROR ! " Customer not found";
else
response # Const.OK ! " " ! result;
} else if (command.equals(Const.AUTHENTICATE)){
String password # parser.nextToken();
employee # Long.parseLong(param);
String result # market.
authenticate(employee,password);
if (result ## null )
response # Const.ERROR !
" Wrong employee or password";
else
response # Const.OK ! " " ! result;
} else if (command.equals(Const.BUY)){
String quantity # parser.nextToken();
if (transaction ## 0)
transaction # market.
startTransaction(customer,employee);
market.buy(Long.parseLong(param),
Long.parseLong(quantity),transaction);
response # Const.OK;
} else if (command.equals(Const.END)){
market.endTransaction(transaction);
transaction # 0;
response # Const.OK;
} else if (command.equals(Const.ABORT)){
market.abortTransaction(transaction);
transaction # 0;
response # Const.OK;
Search WWH ::




Custom Search