Question: Question is that the program given below read it carefully and then tell what is the purpose of program and how it work.... import java.util.ArrayList;

Question is that the program given below read it carefully and then tell what is the purpose of program and how it work....

Question is that the program given below read it carefully and then

tell what is the purpose of program and how it work.... import

java.util.ArrayList; import java.util.Scanner; public class Bankingsystem { static ArrayList allClients; static ArrayListallAccounts;

static Scanner input: static void showAllAccounts(/ for(int i=0;i BankAccount newAccount =null; System.out.println("enter

account balance"); double balance - input.nextDouble(); if(accType=1) newAccount = new BankAccount balance);

Jelse if(accType==2 newAccount = new Savings BankAccount balance): = newAccount.setOwner(newClient); newClient.setAccountinewAccount); allAccounts.add(newAccount:

allClients.add(newClient); System.out.println("account created successfully"); } public static void main(String[] args) { allAccounts

= new ArrayList(); all Clients = new ArrayList(); input = new Scanner(System.in);

addTestData(); while(true) { System.out.println("1- ADD ACCOUNT"); System.out.println("2- LIST OF ALL ACCOUNT"); System.out.println("3-

SEARCH FOR ACCOUNT"); System.out.println("4- REMOVE AN ACCOUNT"); System.out.println("5-WITHDRAW"); System.out.println("6- DEPOSIT"); System.out.println("7-EXIT"); int

option=input.nextInt(); if (option == 1) { addAccount); } else if (option ==

2) { showAllAccounts(): } else if (option == 3) { searchFor Account();

import java.util.ArrayList; import java.util.Scanner; public class Bankingsystem { static ArrayList allClients; static ArrayListallAccounts; static Scanner input: static void showAllAccounts(/ for(int i=0;i BankAccount newAccount =null; System.out.println("enter account balance"); double balance - input.nextDouble(); if(accType=1) newAccount = new BankAccount balance); Jelse if(accType==2 newAccount = new Savings BankAccount balance): = newAccount.setOwner(newClient); newClient.setAccountinewAccount); allAccounts.add(newAccount: allClients.add(newClient); System.out.println("account created successfully"); } public static void main(String[] args) { allAccounts = new ArrayList(); all Clients = new ArrayList(); input = new Scanner(System.in); addTestData(); while(true) { System.out.println("1- ADD ACCOUNT"); System.out.println("2- LIST OF ALL ACCOUNT"); System.out.println("3- SEARCH FOR ACCOUNT"); System.out.println("4- REMOVE AN ACCOUNT"); System.out.println("5-WITHDRAW"); System.out.println("6- DEPOSIT"); System.out.println("7-EXIT"); int option=input.nextInt(); if (option == 1) { addAccount); } else if (option == 2) { showAllAccounts(): } else if (option == 3) { searchFor Account(); } else if (option==4) { removeAccount(); } else if (option ==5) { withdraw(); } else if (option == 6) { deposit(); } else if (option == 7) { break; } } static void addTestData() for(int i=0;i balance--amountOfMoney: return true; public boolean deposit/double amountOfMoney if(amountOf Moneyc=0 System.err.println("invalid amount"); return false; } balance+ amount of money, return true; } public Client getowner() { return owner; } public void setOwner(Client owner) { this.owner = owner, } public void view System.out.println("account id : "+accountid); System.out.println("balance : "+balance): owner.view: } } public class Client { String name, String address: String phone Bank Account account: public Client(String name, String address, String phone) { this.name = name; this.address = address: this.phone = phone; } public String getName() { return name: } public void setName(String name) { this.name = name; } public String getAddress() { return address: } public void setAddress(String address) { this.address = address; } public String getPhonel) { return phone; } public void setPhone(String phone) { this.phone = phone; } public BankAccount getAccount() { return account: } public void setAccount (BankAccount account) { this account = account: } public void View System.out.println("name : "+name); System.out.println("address : "+address); System.out.println("phone : "+phone); // account.view(); } } public class SavingsBankAccount extends BankAccount private double minimumBalance; public Savings BankAccount() { super(1000); minimum Balance = 1000, } public SavingsBankAccount(double balance) super(balance); minimumBalance=1000; } public double getMinimumBalancel) { return minimumBalance; } public void set MinimumBalance[double minimumBalance) { this.minimumBalance = minimumBalance; } @Override public boolean withdraw(double amountOf Money) { if(balance-amountOfMoney>=minimumBalance}{ balance-amountOfMoney: return true; } System.err.println("invalid amount"); return false; } @Override public boolean deposit/double amountOf Money) {

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!