question archive In the first round of HR interview for a banking sector, HR decides to make candidates design an application which provides only information on transaction like amount withdrawn with respect to fields given
Subject:Computer SciencePrice:2.87 Bought7
In the first round of HR interview for a banking sector, HR decides to make candidates design an application which provides only information on transaction like amount withdrawn with respect to fields given. Develop a program to implement this scenario.
Creat a class Account with the attributes:
The method boolean withdraw(int) used to calculate the current balance of the respective account. Before that it should enough balance. If there is enough balance, deduct the amount from the balance and print "Balance amount after withdraw: XXX" and return true. If there is no enough balance, print "Sorry!!! No enough balance" and return false.
Creat a class AccountDetails with main function and the below methods :
Use appropriate getters and setters.
Note:
All classes and methods should be declared as public and attributes should be private.
Use the same attribute names as given in the question and camel case notation for methods. Name of book and author can have space in between.
Sample input 1:
Enter account id:
100
Enter account type:
Savings
Enter balance:
10000
Enter amount to be withdrawn:
500
Sample Output 1:
Balance amount after withdraw: 9500
Sample input 2:
Enter account id:
101
Enter account type:
Savings
Enter balance:
1000
Enter amount to be withdrawn:
1500
Sample Output 2:
Sorry!!! No enough balance
Sample input 3:
Enter account id:
100
Enter account type:
Savings
Enter balance:
-100
Balance should be positive
Enter balance:
5000
Enter amount to be withdrawn:
500
Sample Output 1:
Balance amount after withdraw: 4500
Purchased 7 times