int amt=0;
try {
amt = Integer.parseInt(req.getParameter("AMOUNT"));
}
catch (NullPointerException e) {
// No Amount Parameter passed
}
catch (NumberFormatException e) {
// Amount Parameter was not a number
}
synchronized(act) {
if((req.getParameter("WITHDRAW") != null) && (amt < act.balance))
act.balance = act.balance - amt;
if((req.getParameter("DEPOSIT") != null) && (amt > 0))
act.balance = act.balance + amt;
} // end synchronized block
doGet(req, resp); // Show ATM screen