Display all of the elements of the arraylist

Assignment Help JAVA Programming
Reference no: EM13940032

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: EM13940032

Questions Cloud

Understanding of the nature and extent of problem : In your answer, you will need to demonstrate some understanding of the nature and extent of the 'problem' before applying your chosen sociological theory. You will need to use at least 8 authoritative sources (journal articles, textbooks, etc.)
Compute the number of units of each product : The selling prices are $30 for squares and $50 for circles. Compute the number of units of each product that must be sold for Gosnell Company to break even.
A new business venture producing teddy bears : Peter Jones, is looking to set up a new business venture producing Teddy Bears. He has some good contacts in the retail sector and expects to be able to produce and sell 20,000 units per month, for the foreseeable future.
Code that sorts the household sizes in ascending order : The program should allow the user to enter each household size and determine the mean and median household size in Marengo. Need to write the code that sorts the household sizes in ascending order using a bubble sort.
Display all of the elements of the arraylist : 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.
Identify the objectives of the activity : 1. Provide a brief description of the activity for which the risk management process will be applied. Be clear and concise, indicating the exact aim of the activity 2. Identify the objectives of the activity (the risk identification exercise in Pa..
How would you determine reasonable : Assume that you are the chair of the PGA Rules Committee. Following the Martin decision (PGA Tour,Inc V Martin 531 U.S. 1049 2001), you are charged with reviewing the rules and developing a policy on how to determine reasonable accommodation. What..
Find the margin of error : Find the critical value for zα/2 that corresponds to a degree of confidence of 98%. Find the margin of error for the 95% confidence interval used to estimate the population proportion with n = 163 and x = 96
Proposals using the calculations above to explain : Jamie Oliver is considering expanding his restaurant trade. He has the following two proposals to consider. A minimum of a 12% return on investment is required from the recommended project.

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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