Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using java Remember that arraylists are good for adding and removing things, and that they are clock-cycle friendlier in this case than resizing arrays as

using java

Remember that arraylists are good for adding and removing things, and that they are clock-cycle friendlier in this case than resizing arrays as we discussed in lecture. This lab allows you to get some hands-on using an arraylist so you will remember it for those times it would be a good fit for an application.

a) Create an Arraylist of type String and prompt the user for three names and add these names to your ArrayList.

b) Print a message with the number of elements in the ArrayList for the user using the size() method (to find the number to print.)

c) Prompt the user for two more names and add them to the ArrayList and once again print a message with the number of elements in the ArrayList for the user.

d) Use a loop to print all of the names in the ArrayList for the user.

e) Ask the user for a name to remove, remove the value the user provides, and then use an enhaced for loopto print all of the names in the ArrayList for the user. (You are required to use an enhanced for loop at least once or you will get 3 points deduction)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Hands On Database

Authors: Steve Conger

1st Edition

013610827X, 978-0136108276

More Books

Students also viewed these Databases questions