1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
zhannawk [14.2K]
3 years ago
8

"The goal of this assignment is to give you some experience building a program that uses objects. You will use the BankAccount c

lass you created in Lab 3 to create a banking program. The program must display a menu to the user to allow the user to select a transaction like deposit, withdraw, transfer, create a bank account, and quit the program. The program should allow a user to perform multiple transactions until they quit the program by selecting the quit option. The program must perform all operations on the BankAccount objects your program will store. The operations must search through the collection of BankAccount objects and find the correct object to perform the operation on. When a user creates an account, your program should create a new BankAccount object with the user's input values and store it in an Array or ArrayList."
Computers and Technology
1 answer:
MArishka [77]3 years ago
3 0

Answer:

see explaination

Explanation:

Please find my detailed implementation.

I have tested with Single Bank account object.

You can create array list of Bank Account in test program:

public class BankAccount {

private String name;

private int accountNumber;

private int PIN;

private double balance;

public BankAccount(int accN, int pin) {

accountNumber = accN;

PIN = pin;

}

public BankAccount () {

name = "Undefined";

accountNumber = 0;

PIN = 0;

balance = 0;

}

public String getName() {

return name;

}

public int getAccountNumber() {

return accountNumber;

}

public int getPIN() {

return PIN;

}

public double getBalance() {

return balance;

}

public void setName(String name) {

this.name = name;

}

public void setAccountNumber(int accountNumber) {

this.accountNumber = accountNumber;

}

public void setPIN(int pIN) {

PIN = pIN;

}

public void setBalance(double balance) {

this.balance = balance;

}

public void withdrawal(double amount) {

if(amount <= balance) {

balance = balance - amount;

}

}

public void deposit(double amount) {

balance += amount;

}

public void transferFunds (double amount, BankAccount toBankAccount) {

if(amount >= balance) {

toBankAccount.setBalance(amount + toBankAccount.getBalance());

balance -= amount;

}

}

atOverride //change the at with the at symbol

public String toString() {

return "{id:"+accountNumber+", name:"+name+", pin:"+PIN+", balance:$"+balance+"}";

}

}

#########

public class BankAccountTest {

public static void main(String[] args) {

BankAccount myAccount = new BankAccount(526323450, 1234);

myAccount.setName("Pravesh");

myAccount.setBalance(345.64);

System.out.println(myAccount);

BankAccount anotherAccount = new BankAccount(); //default constructor

System.out.println(anotherAccount);

}

}

You might be interested in
When completing an application what color ink do you use
tankabanditka [31]

Black or blue pen would be appropriate.

5 0
3 years ago
Read 2 more answers
If you are writing an algorithm and you aren’t confident that you understand the problem, what can you do?
Zigmanuir [339]

Answer:

divide it into smaller pieces

Explanation:

Usually, the main reason a programmer does not understand a problem fully is that there is too much information. The best way to try and fully understand a problem is to divide it into smaller pieces. Start off by answering the question what is the expected output for an input. Then divide each individual issue within the problem. This will allow you as a programmer/developer to create an individual solution for each individual issue within the problem and then test to make sure that the input gives the correct output.

8 0
3 years ago
please help, touch pad and trackpad are the same thing and the other answers don’t really make sense to me..
WINSTONCH [101]

Answer:

The answer to the problem is B

8 0
2 years ago
If you define a function name, and it turns purple instead of blue, what should you do?
xenn [34]
You should change the name of the function
3 0
3 years ago
You wish to enter your exam scores in a spreadsheet. Which function will help you find how each subject’s score relates to the o
KonstantinChe [14]

a is the correct answer

8 0
3 years ago
Read 2 more answers
Other questions:
  • Your friend is working on fixing their Homework assignment. They need a lot of help. You know all the bugs in the file, but due
    12·1 answer
  • When u look at a green object through red glass the object will appear
    11·2 answers
  • Which of the following is true about REST?
    12·1 answer
  • A vast global network that is made up of many smaller interconnected networks is known as:
    13·2 answers
  • 5. The shell of a document that may be used over and over in desktop publishing is called a
    14·2 answers
  • In which type of market do farmers sell their produce directly to village traders in rural areas?
    14·1 answer
  • A high school in New York (school A) is using videoconferencing technology to establish student interactions with another high s
    7·1 answer
  • A ____ object is used to hold data that is retrieved from a database via the OleDbDataAdapter connection. a. DataRecord b. DataS
    12·2 answers
  • One of the most common uses of spreadsheet are
    8·1 answer
  • Suppose that each country completely specializes in the production of the good in which it has a comparative advantage, producin
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!