Q9

Question 9

Implement a Bank Account having Instance variables: Account Number, Balance and having methods:

  • float Deposit (float x)

  • float withdraw (float x)

  • int get account no ()

  • float get balance ()

  • tax deduction ()

Then implement class Bank having an array list of accounts of type BankAccount. Implement following methods:

  • AddAccount in Bank

  • Get Total balance in Bank

  • Get account number with max. and min. balance

  • Find an account given a bank account no.

  • Count no. of accounts having atleast specific balance

Code Insights

Created a static Account class which stores all possible attributes of a Bank Account, wrote method for Deposit, withdraw, get account number, get account balance and total balance, tax deduction and auto generate a unique account number for new accounts (starting series is 2000 and 2001 then 200x...)

Made Menu-Driven options to work on Bank Operations and Individual Account (withdraw-deposit-tax)

Browse Source Code

Code

14KB
Open
Download java_4.java

Output

Image-1/15 output for java_4.java
Image-2/15 output for java_4.java
Image-3/15 output for java_4.java
Image-4/15 output for java_4.java
Image-5/15 output for java_4.java
Image-6/15 output for java_4.java
Image-7/15 output for java_4.java
Image-8/15 output for java_4.java
Image-9/15 output for java_4.java
Image-10/15 output for java_4.java
Image-11/15 output for java_4.java
Image-12/15 output for java_4.java
Image-13/15 output for java_4.java
Image-14/15 output for java_4.java
Image-15/15 output for java_4.java
Live Demo java_4.java

Last updated