Creates a simple arraylist

Assignment Help Basic Computer Science
Reference no: EM13669426

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:

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.

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.

Compile, run, and check the results. Submit the following:

The source file for each of the classes created (If more than one file has been created, zip them into one .zip file for posting.)

 

Reference no: EM13669426

Questions Cloud

Determine voltage dropped across synchronous impedance : Draw the synchronous generator's per phase voltage and current phasor diagram and calculate the per phase output voltage and determine the voltage dropped across the synchronous impedance
What is an estimated return that shareholders of nab : What is an estimated return that shareholders of NAB expect to earn and what is weighted average cost of capital (WACC) - How the increase in liability will affect WACC of NAB.
Write a memorandum-developmnent of family-owned business : In a recent commentary on governance in family firms, a leading executive search consultancy argued, Corporate governance is a critical enabling factor for the developmnent of family-owned business.
Difference between the cooling rate and hardenability : What is the difference between the cooling rate and hardenability? How the sample sizes affect the cooling rate and hardenability and martensite can also be obtained through water quenching of alloy steels, why oil quenching is normally used in in..
Creates a simple arraylist : Creates a simple ArrayList
Find the rms current phase angle and rms voltage : Find the rms current, phase angle and rms voltage across R & L, in an RL circuit when a 58 Hertz 123 Volt rms ac voltage is applied, where R=1.80 kΩ and L=350 mH
What are search methods : What are search methods? Do you feel search methods are relevant to topics in artificial intelligence ? If yes, please explain why and how. Specifically, describe how search methods would be used for rule-based systems, expert systems, resolu..
Basic business skills play a role in your professional life : How will basic business skills play a role in your professional life?
Linear programming case study : Explain what the results mean - write a paragraph addressing the part of the problem pertaining to sensitivity analysis and shadow price.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Write a segment of java code that will rotate the elements

Write a segment of Java code that will rotate the elements of an array by one position, moving the initial element to the end, like.

  Write a statement that assigns true to recalled

A bool variable named recalled has been declared. Given an int variable modelYear write a statement that assigns true to recalled if the value of modelYear falls within the recall range and assigns false otherwise. Do not use an if statement in th..

  List at least five different pieces of hardware

(1) Identify the hardware you have on your computer and catagorize each piece as input, output, or both. (2) List at least five different pieces of hardware with at least one of each category.

  Determine relation of m and n-existence of a hash function

Determine the most general relation of m and n that guarantees the existence of a hash function in H that causes no collision when hashing [n] into [m].

  Describe the web-based information technologies

Describe the Web-based information technologies

  Use one supper class and two sub classes

Give a UML example illustrating aggregation. Include classes, fields, methods, instance fields, etc.Use one supper class and two sub classes.inlcude pseudo code for at least one method of each class l. Also explain the whole part relationship and ..

  Which resumes are chosen for further scrutiny

Often a candidate's suitability for a particular job application is determined by the keywords identified by the software used for the purpose of screening.

  Is this something to do with precedence

Please could you explain why 2**2**0=2

  Explain customer relationship management system

Describe what do you mean by a "customer relationship management system". Write and explain several categories of CRM systems.

  Search the internet for owasp

Define the acronym and locate the most current top 10 Web-application security risks

  Implementing strong password policy

How do you implement strong password policy given dilema of forgotten passwords? How would you address these issues?

  Largest positive octal number that can be stored in pdp-9

Data was stored in the PDP-9 computer using six-digit octal notation. Negative numbers were stored in 8's complement form. What is the largest positive octal number that can be stored in this machine?

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