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

  Importance of first designing a program using an algorithm

Programs must be very thoroughly designed before they are written. In this assignment, you will discuss the importance of first designing a program using an algorithm, pseudocode, and flowcharts before writing the actual code.

  Provide a description of the algorithm in pseudocode

You are required to create a detailed analysis for each of the following array-based sorting algorithms.

  Write z schemas defining state of the system card validation

Write Z schemas defining the state of the system, card validation (where the user's identifier is checked) and cash withdrawal.

  Determine thickness if mass of tank is given

Determine x if the mass of the tank is 18 kg. The density of stainless-steel is 7920 kg/m^3. Note: use MATLAB script file to find x.

  Finding instruction format for indirect addressing

Determine the instruction format, considering that there is no bit for indirect addressing.

  Implement a system for car dealership

Suppose that you are required to implement a system for a car dealership. The system needs to store information about each customer. This includes the customer's ID number, name, address and contact number.

  Sums each row in the array and displays the results

A. Write code that sums each row in the array and displays the results.

  Using information in the lesson 09 online content

Using information in the Lesson 09 Online Content

  What is the expected number of floors the elevator stops

A building has n floors numbered 1, 2, . . . , n, plus a ground floor G.

  Assume an open addressing hash table

Assume an open addressing hash table, with a load balance α given. What is the expected number of probs needed when searching a key x that is in the table. Note that the development shown in class was for the case that x is not in the table.

  How many other machines is each machine equivalent to

Every Turing machine is equivalent to some other machine in our enumeration. Why? How many other machines is each machine equivalent to? How many times is each Turing-computable function represented in our enumeration? Be sure to justify your answ..

  Constructs an internal linked representation of the tree

Output Your program must print a string representing the postorder traversal of the tree followed by a newline character.

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