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

  Reconfiguring the network for your company

You have been tasked to reconfigure the network for your company that has grown noticeably over the past year. You have used only the static routing in past, however you do not wish to spend the administrative time required to monitor the routing ..

  Project management process

Discuss what do you meant by the project management process in detail? Also state and describe the six project steps, its application to the technology projects.

  Does case or object-oriented design techniques used

consider the alternatives that were considered during the design stage of the project. What were the considerations in choosing the best alternative strategy.

  Explain basic wireless network maintenance functions

Occasionally after upgrading firmware, the antennas in your wireless network want to be adjusted. What technology may someday eliminate this need for antenna maintenance.

  How to research the development technologies

how to Research the development technologies below and type up a sum,mary of them.

  How to create a set in third normal

How to create a set in third normal RESERVATION(reservation id, date of reservation, start date, end date, (( customer id, customer name, customer address, customer type, customer type description, ((customer preferences)), customer credit card n..

  Characteristics of rdbms

Explain the characteristics of the Relational Database Management System (RDBMS).

  Write c program ''myls'' that functions like unix command ''ls''

Write C program 'myls' that functions like unix command 'ls'.

  Explaining the rsa

Using the RSA with p = 3, q = 11, e = 7: Explain the suitable value for d? Encode the message “cat” by encrypting each letter separately, i.e., by encrypting ASCII code of each letter.

  Read and follow the directions in creating an archive

How do the algorithm techniques of fragmentation affect the end result of sorting by larger amounts.

  Ssl protection

Explain whether pages are served over the SSL protected from problem you explained. If so, explain why; if not, explain why not.

  Determining the compliment of a number

Express 64 as the 2’s compliment number. Specify the number of bits you require? With this number of bits, state the largest positive number you may represent?

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