Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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....

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 15th International Conference Dexa 2004 Zaragoza Spain August 30 September 3 2004 Proceedings Lncs 3180

Authors: Fernando Galindo ,Makoto Takizawa ,Roland Traunmuller

2004th Edition

3540229361, 978-3540229360

More Books

Students also viewed these Databases questions

Question

Understanding Group Leadership Culture and Group Leadership

Answered: 1 week ago