Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1: Write a program that reads words into two ArrayLists list1 and list2 and then creates a third ArrayList that contains words which are

Question 1: Write a program that reads words into two ArrayLists list1 and list2 and then creates a third ArrayList that contains words which are common to both list1 and list2. You may assume that the strings are entered as words separated by a space on a single line and the end is signaled by -1 (String -1). You can use keyboard.next() to read each word.

Question 2: Write a program that reads words into an ArrayList list1 and creates another ArrayList list2 that has the same words in list1 but no duplicates.

*I am using JGrasp so please make sure it is compatible *Please comment throughout code *FULL QUESTION IN IMAGES BELOWimage text in transcribed

Exercise 1: Write a program that reads words into two ArrayLists list 1 and list2 and then creates a third Array List that contains words which are common to both list1 and list2. You may assume that the strings are entered as words separated by a space on a single line and the end is signaled by "-1" (String -1). You can use keyboard.next0 to read each word. A sample dialog is shown below Enter words on one line, end with -1 java c pascal ada java c++ -1 Enter words on one line, end with -1 c pascal java lisp isp -1 java c, pascal ada java, C++] CC, pascal java, lisp, lisp Array List with common strings: [c, pascal java Exercise 2: Write a program that reads words into an ArrayList list1 and creates another ArrayList list2 that has the same words in list1 but no duplicates. A sample dialog is shown below: Enter words on one line, end with -1 java c pascal ada java java ada C++ -1 Array List with no duplicates java C, pascal ada c++]

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

Genetic Databases

Authors: Martin J. Bishop

1st Edition

0121016250, 978-0121016258

More Books

Students also viewed these Databases questions

Question

=+j Describe the various support services delivered by IHR.

Answered: 1 week ago

Question

=+j Explain IHRMs role in global HR research.

Answered: 1 week ago

Question

=+j Describe an effective crisis management program.

Answered: 1 week ago