Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Code in Java and do so without using methods .contains or .indexOf ArrayList - Where Is It? Create an ArrayList that can hold Integers, and

image text in transcribed

Code in Java and do so without using methods .contains or .indexOf

ArrayList - Where Is It? Create an ArrayList that can hold Integers, and fill each slot with a different random value from 1-50. Display those values on the screen, and then prompt the user for an integer. Search through the ArrayList, and if the item is present, give the slot number where it is located. If the value is not in the ArrayList, display a single message saying so. If the value is present more than once, you may either display the message as many times as necessary, or display a single message giving the last slot number in which it appeared. ArrayList: [45, 39, 32, 12, 44, 50, 26, 42, 16, 20] Value to find: 42 42 is in slot 6. ArrayList: [45, 39, 32, 12, 44, 50, 26, 42, 16, 20] Value to find: 43 43 is not in the ArrayList. ArrayList: [24, 30, 31, 24, 32, 33, 34, 24, 35, 36] Value to find: 24 you may display either 24 is in slot O. 24 is in slot 3. 24 is in slot 7. or 24 is in slot 7

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

Step: 3

blur-text-image

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

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions