Question: 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 BELOWQuestion 1: Write a program that reads words into two ArrayLists list1

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!