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
liraira [26]
3 years ago
5

import java.util.ArrayList; // Needed for ArrayList class /** This program demonstrates how to store BankAccount objects in an A

rrayList. */ public class ArrayListDemo6 { public static void main(String[] args) { // Create an ArrayList to hold BankAccount objects. ArrayList list = new ArrayList(); // Add three BankAccount objects to the ArrayList. list.add(new bankAccount(100.0)); list.add(new bankAccount(500.0)); list.add(new bankAccount(1500.0)); // Display each item. for (int index = 0; index < array.size(); index++) { BankAccount account = list.get(index); System.out.println("Account at index " + index + "\nBalance: " + account.getBalance()); } } }
Computers and Technology
1 answer:
slega [8]3 years ago
7 0

Answer:

import java.util.ArrayList; // Needed for ArrayList class

/** This program demonstrates how to store BankAccount objects in an ArrayList. */

// Class ArrayListDemo6 is defined

public class ArrayListDemo6 {

// main method that begin program execution

public static void main(String[] args) {

// Create an ArrayList to hold BankAccount objects.

// The arraylist is called list

ArrayList list = new ArrayList();

// Add three BankAccount objects to the ArrayList.

list.add(new bankAccount(100.0)); list.add(new bankAccount(500.0)); list.add(new bankAccount(1500.0)); // Display each item using a for loop

for (int index = 0; index < array.size(); index++)

{ BankAccount account = list.get(index);

System.out.println("Account at index " + index + "\nBalance: " + account.getBalance());

}

}

}

Explanation:

The code is written in Java and more comments has been added to make it more explanatory.

The code snippet is a demonstration on Arraylist.

First Arraylist is imported. Then, ArrayListDemo6 class is defined. Then the main method which begin program execution.

Inside the main method, a new Arraylist is created called list.

Then we add three BankAccount object to the list.

Lastly, we use a for loop to display each added BankAccount object.

You might be interested in
Uses of prototype and who made the prototype<br>​
myrzilka [38]

Answer:

A prototype is an early sample, model, or release of a product built to test a concept or process. It is a term used in a variety of contexts, including semantics, design, electronics, and software programming. A prototype is generally used to evaluate a new design to enhance precision by system analysts and users.

Explanation: The place that made prototype was Radical Entertainment.

Hoped this helped.

3 0
3 years ago
1 Which skill-based video game requires quick reflexes and skills with weapons?
kirill [66]

The Answer to Number 1 is Shooter Games

The Answer to Number 2 is Dice Throwing

The Answer to Number 3 is Games are organized play

The Answer to Number 4 is Either Simulation or Adventure

The Answer to Number 5 is Stories have no rules to follow, you can learn from countless other lifetime through stories

The Answer to Number 6 is Setting

The Answer to Number 7 is False

The Answer to Number 8 is Objective

7 0
2 years ago
HAIIIIIII ANYONE FEELING JOLLY OR SAD
Karo-lina-s [1.5K]

Answer:

Heyy I'm feeling sad and stressed. Wbu?

Explanation:

8 0
3 years ago
Read 2 more answers
What are the products that are produced in cottage industry?​
Elenna [48]

Answer:

Baskets, Pots, Mats, Clothes

3 0
3 years ago
Which of these is not part of a consumer profile??
matrenka [14]
Which of what? What is the complete question???
6 0
2 years ago
Other questions:
  • Integration Management, one of the 10 PMBOK Guide Knowledge Areas, represents the processes and activities to identify, define,
    12·1 answer
  • Is a process in which an attacker attempts to acquire information about your network and system by social means, such as talking
    9·1 answer
  • Can multiple processors can be installed in a single processor housing?
    14·2 answers
  • Write an if else statement that assigns 0 to the variable b and assigns 1 to the variable c if the variable a is less than 10. O
    5·1 answer
  • Which statement accurately describes DTP programs?
    11·1 answer
  • Question 4 (Multiple Choice Worth 5 points)
    6·1 answer
  • To delete only the selected contents of the table, but not the table itself, ____.
    7·1 answer
  • What are two options available for highlighting changes in the Highlight Changes dialog box?
    11·2 answers
  • If you delete a conversation many times with someone like this, will you stop receiving messages from them?
    13·1 answer
  • Usually it is a rectangular box placeed or underneath your desk​
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!