- Suppose, you are implementing “Overdraft Account (OD)” class using java for a banking app. An OD type account is opened with an approved loan limit (ex 100000/-). The account holder can deposit any amount of money in the OD account at any time. S/he can draw an amount of money from the account (acn) until sufficient acn balance. S/he allowed to draw money beyond his/her acn balance if the total over-drawing amount remains within the loan limit. A java sketch for OD acn is given bellow & code is expected to run in multi-threading mode. (same code with run by different counter in the blank)
Code:
public class ODAccount extends BankAccount {
double limit;
public void ODAccount (double setLimit) {
$this->balance= 0; //super class has balance property
$this->limit= setLimit;
}
public void depositMoney (double deposit Amount) {
balance= balance+ depositAmount;
public void drawMoney (double drawAmount) throws ODLimit Exceeded {
if (balance – drawAmount>=-1*limit)
balance= balance- drawAmount;
else throw new OD Limit Exceeded ();
}
Mr. Fraud one of your friend has an OD acn with 300.00 loan limit & 420.00 @ any instant. Thus, he can draw up to 720.00. He needs total of 800/- & he applies a trick as he knows the code structure. He writes 2 cheques of 400.00/- & produce both cheques at two banks simultaneously. Explain probability he is able to draw amount of his OD limit. How can u handle the problems mentioned in the question? Write necessary java codes to solve the problem.