Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

class Account { private String name; private double balance; public Account(String name, double balance) { this.name = name; this.balance = balance; } public String getName()

class Account {

private String name;

private double balance;

public Account(String name, double balance) {

this.name = name;

this.balance = balance;

}

public String getName() {

return name;

}

public void setName(String name) {

this.name = name;

}

public double getBalance() {

return balance;

}

public void setBalance(double balance) {

this.balance = balance;

}

public void deposit(double amount) {

balance += amount;

}

public void withdrawal(double amount) {

if (balance >= amount) {

balance -= amount;

} else {

System.out.println(" Insuficient Balance. ");

}

}

}

class Bank {

ArrayList accounts = new ArrayList<>();

Scanner input = new Scanner(System.in);

int userInput;

Scanner q;

String name;

double balance;

public void enterCustomers() {

System.out.println("Enter customer names or press q to quit entering names: ");

while(true) {

String name;

double balance;

System.out.print("Enter a customer name: ");

name = input.next();

if ("q".equalsIgnoreCase(name))

break;

System.out.print("Enter the opening balance : ");

balance = input.nextDouble();

accounts.add(new Account(name, balance));

}

}

usin the account class and bank class given can someone please create a banking method that will be able to deposit or withdraw an amount to or from the account. use an integer to select to (1) deposit, (2) withdraw or (0) quit; It will continue to repear options till 0 is pressed to quit; you should not relay on the order/index of the list to determine the customers account. You should make sure the accounts name matches the customers name. just please use sime if switch do and while statements only thanks.

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 31st International Conference Dexa 2020 Bratislava Slovakia September 14 17 2020 Proceedings Part 1 Lncs 12391

Authors: Sven Hartmann ,Josef Kung ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

303059002X, 978-3030590024

More Books

Students also viewed these Databases questions

Question

how would you have done things differently?

Answered: 1 week ago

Question

3. What information do participants need?

Answered: 1 week ago