Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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 runStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started