Question: In java Public class BankAccount{private String name; private double balance; public BankAccount (double b, String s){balance =b; name = n;} public deposit (double d){balance d;}

 In java Public class BankAccount{private String name; private double balance; publicIn java

Public class BankAccount{private String name; private double balance; public BankAccount (double b, String s){balance =b; name = n;} public deposit (double d){balance d;} public deposit (double d) {balance += d;} public withdraw (double w) {balance -= w;} public String getName() {return name;} public string getBalance() {return balance; public string toString(){return 'name: + name + "balance: " + balance;}} Create one BankAccount object called acotl with the name "Savings" and a balance of $525. Create an array to hold 5 BankAccount objects called myAcets Store the account object created in question as the first element in the arraymyAccta. Instantiate the object at index 3 with the values $1000 and name "vacation". Deposit $75 to the account with index 2. Assume index 2 is not null. Withdraw $100 from the account with index 4. Assume index 4 is not null. Write a loop to print out all of the accounts in the array myAccts

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!