Add items to the arraylist

Assignment Help Computer Engineering
Reference no: EM1329370

I am still sorting through this chapter on arrays and ran into another exercise that I do not understand. If someone could please help a struggling single mom figure this out it would be much appriciated. This program is in Java.

The following code creates a simple ArrayList:
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.util.ArrayList;
public class Ex01 {
public static void main(String[] args) throws IOException {
BufferedReader userInput = new BufferedReader
(new InputStreamReader(System.in));
ArrayList<String> myArr = new ArrayList<String>();
myArr.add("Zero");
myArr.add("One");
myArr.add("Two");
myArr.add("Three");
}
}
Starting with this provided code, add the following functionality:
1. Add items to the ArrayList, one at a time, based on user typed input. The user will be prompted for the String to be stored in the ArrayList and then hit enter. The user will be able to continue to add items to the ArrayList until they just hit enter without typing anything.
2. Once the user does this (hits enter without typing anything), the program will display all of the elements of the ArrayList, both the index and String values, in a table. It will do this via a single loop.

Reference no: EM1329370

Questions Cloud

The differences of creativity and innovation : The solution is a discussion on what can occur when a marketing campaign completely misses the target audience. There is an analysis on the differences of creativity and innovation.
Operational and supply chain management : Operational and Supply Chain Management - Why are companies interested in operational management today
Constitutional challenge : The Minnesota Supreme Court found evidence to the contrary: The jugs took up less space and required less energy to produce.
Expalin how are the current real stock of money : Expalin how are the current real stock of money in the U.S. and real interest rates computed.
Add items to the arraylist : Add items to the ArrayList, one at a time, based on user typed input. The user will be prompted for the String to be stored in the ArrayList and then hit enter. The user would be able to continue to add items to the ArrayList until they just hit e..
Explain country risk and strategic planning : Explain Country Risk and Strategic Planning and Select and justify and appropriate mode of entry for my global service
Explain the need for supply chain management : Explain the need for supply chain management in your selected organization. Also, describe the elements of the supply chain
Type of power to win over group : Which type of power would help him win over his group in this situation.
Define creating an exam object using java : define Creating an Exam Object using Java

Reviews

Write a Review

Computer Engineering Questions & Answers

  What required to execute a particular benchmark program is

The performance of any computer system can be evaluated in measurable technical terms using one or more of the metrics. This was the performance could be compared relative to other systems or the similar system before/after changes. It can also by..

  Convert csv file into html file

Convert CSV file into HTML file

  What security suggestions does laptop follows

explain to Andersen & Sons how they might create a security template and some useful settings. What security suggestions do you have to secure communications from Human Resources server to the Payroll server.

  Studying the properties of a network

Studying the properties of a network

  Challenges of internet search

State different challenges of relying over the Internet for your research?In extending a single-system mail system to distributed mail system, state the key additions which should be involved? Discuss in scholarly detail.

  Similarities and differences to issue of regulation

Describe the relevance of each of these similarities and differences in order to issue of regulation of the Internet.

  Make a heading that contains the name of the software

discuss a specific virus software, its advantages and disadvantages. make a heading that contains the name of the software you are reviewing. It should be about half-page or less.

  How the project management life cycle be efficient

How the Project Management Life Cycle be efficient.

  Examine the key components of a decision support system

Examine the key components of a decision support system

  Analyzing the database schema

OrderLine (OrderNum, PartNum, NumOrdered, QuotedPrice), Part (PartNum, Description, OnHand, Class, Warehouse, Price), On the basis of code above, list the number and name of all the customers.

  Web search engine

Utilizing a Web search engine, determine an article from the reputable source published in the past six months which reports on relative risk that comes.

  Describe a project that increase an intranet

Describe a project that increase an Intranet.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd