import java.util.LinkedList; import java.util.Random; import java.util.Scanner; /** * author * */ public class LinkedListTest { /** * param args */ public static void main(String[] args) { int M, N, Lower, Upper; Scanner scanner = null; try { LinkedList list1 = new LinkedList(); LinkedList list2 = new LinkedList(); LinkedList list3 = new LinkedList(); Random random = new Random(); scanner = new Scanner(System.in); System.out.print(\"Enter the Lower and Upper bounds:\"); Lower = scanner.nextInt(); Upper = scanner.nextInt(); System.out.print(\"Enter the N value to Insert list1:\"); N = scanner.nextInt(); System.out.print(\"Enter the M value to Insert list2:\"); M = scanner.nextInt(); for (int i = 1; i <= N; i++) { list1.add(random.nextInt((Upper - Lower) + 1) + Lower); } for (int i = 1; i <= M; i++) { list2.add(random.nextInt((Upper - Lower) + 1) + Lower); } System.out.println(\"list1: \" + list1); System.out.println(\"list2: \" + list2); System.out.println(\"Minimum elelment in list1 :\" + getMin(list1)); System.out.println(\"Minimum elelment in list2 :\" + getMin(list2)); System.out .println(\"Count Divisibles by 3 and 5 elelment in list1 :\" + countDivisibles(list1)); System.out .println(\"Count Divisibles by 3 and 5 elelment in list2 :\" + countDivisibles(list2)); System.out.println(\"Common Elements From list1 and list2:\" + getCommonList(list1, list2)); } catch (Exception e) { // TODO: handle exception } } /** * param list * return */ public static int getMin(LinkedList list) { int min = list.get(0); for (Integer integer : list) { if (min > integer) { min = integer; } } return min; } /** * param list * return */ public static int countDivisibles(LinkedList list) { int count = 0; for (Integer integer : list) { if (integer % 3 == 0 && integer % 5 == 0) { count++; } } return count; } /** * param list1 * param list2 * return */ public static LinkedList getCommonList(LinkedList list1, LinkedList list2) { LinkedList list = new LinkedList(); LinkedList listCommon = new LinkedList(); list = (list1.size() > list2.size()) ? list1 : list2; for (int i = 0; i < list.size(); i++) { Integer number = list.get(i); if (list2.contains(number) && list1.contains(number)) { listCommon.add(number); } } return listCommon; } } OUTPUT: Enter the Lower and Upper bounds:1 10 Enter the N value to Insert list1:10 Enter the M value to Insert list2:20 list1: [1, 4, 4, 6, 9, 4, 9, 5, 8, 5] list2: [5, 10, 10, 2, 1, 10, 8, 8, 8, 2, 6, 10, 6, 2, 5, 9, 6, 9, 6, 2] Minimum elelment in list1 :1 Minimum elelment in list2 :1 Count Divisibles by 3 and 5 elelment in list1 :0 Count Divisibles by 3 and 5 elelment in list2 :0 Common Elements From list1 and list2:[5, 1, 8, 8, 8, 6, 6, 5, 9, 6, 9, 6] Solution import java.util.LinkedList; import java.util.Random; import java.util.Scanner; /** * author * */ public class LinkedListTest { /** * param args */ public static void main(String[] args) { int M, N, Lower, Upper; Scanner scanner = null; try { LinkedList list1 = new LinkedList(); L.