Question: Using Java For this lab, please refer to exercises 11.12, 11.13, and 11.14 with the following modification: Instead of having the user enter numbers, your

Using Java

Using Java For this lab, please refer to exercises 11.12, 11.13, and

For this lab, please refer to exercises 11.12, 11.13, and 11.14 with the following modification: Instead of having the user enter numbers, your program is going to generate 10 random integers from 1 to 6. For 11.14, remember that there will be total of 20 when two lists are combined. The outputs from the following are for reference only, your program will display the contents of the ArrayLists only. (Sum ArrayList) Write the following method that returns the sum of all numbers in an ArrayList: public static double sum(ArrayList list) Write a test program that prompts the user to enter 5 numbers, stores them in an array list, and displays their sum. (Remove duplicates) Write a method that removes the duplicate elements from an array list of integers using the following header: public static void removeDuplicate(ArrayList list) Write a test program that prompts the user to enter 10 integers to a list and displays the distinct integers separated by exactly one space. Here is a sample run: Combine two lists) Write a method that returns the union of two array lists of integers using the following header: public static ArrayList union(ArrayList list1, ArrayList list2) For example, the union of two array lists {2, 3, 1, 5} and {3, 4, 6} is {2, 3, 1, 5, 3, 4, 6}. Write a test program that prompts the user to enter two lists, each with five integers, and displays their union. The numbers are separated by exactly one space in the output. Here is a sample run

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!