323 views
0 votes
0 votes
  1. 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.

Please log in or register to answer this question.

Related questions

2 votes
2 votes
2 answers
1
go_editor asked Jul 7, 2016
4,217 views
The mechanism that binds code and data together and keeps them secure form outside world is known asAbstractionInheritanceEncapsulationPolymorphism
1 votes
1 votes
1 answer
2
rsansiya111 asked Oct 7, 2022
375 views
An object whose contents cannot be changed once the object is created is called:(a) Immutable object(b) Mutable object(c) Smart object(d) Rich object
0 votes
0 votes
1 answer
3
sh!va asked Sep 2, 2016
372 views
Spot the features that are present in C++ not in Java:I. New operator II. Delete opeartor III. Objects stored in stack memory. IV . Objects stored in Heap memorya. ...