Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This is java and please must follow the instruction and must put //(comment) and make simple program. Thank you 2. For this problem, I want

This is java and please must follow the instruction and must put //(comment) and make simple program. Thank you

2. For this problem, I want us to practice creating an array of object. We must first have a class to add to our array and for this problem, we are going to use what we already have, BankAccount.

a. Open the BankAccount class, you can use the basic one.

b. Create a BankAccountArrayTester class.

c. Create an array of type BankAccount that holds 10 BankAccount object. You create this by typing: BankAccount[] bankArray=new BankAccount[10].

d. Create a loop.

e. Inside the loop create a BankAccount. Put a different balance in each.

f. Add the BankAccount object to your array. Simply add the variable name to the array.

g. Once you have created the array we need to print it. Create another loop.

h. Inside the loop, we will print the balance for each element of the BankAccount array. Because it is an object, you cant do this directly. You must use the getBalance method. Your code should look something like: System.out.println(Balance is: + bankArray[i].getBalance());

image text in transcribed

image text in transcribed

section 3/BankAccount.ja va 2 A bank account has a balance that can be changed by 3 deposits and withdrawals. 5 public class BankAccount 6 7 private double balance; 8 9 10 Constructs a bank account with a zero balance. 12 public BankAccountO 13 14 balance 0; 15

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_2

Step: 3

blur-text-image_3

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

Beginning ASP.NET 2.0 And Databases

Authors: John Kauffman, Bradley Millington

1st Edition

0471781347, 978-0471781349

More Books

Students also viewed these Databases questions

Question

What is Change Control and how does it operate?

Answered: 1 week ago

Question

How do Data Requirements relate to Functional Requirements?

Answered: 1 week ago