Question
1. Create an Intellij project 2. Add this import to Main.java: import java.util.ArrayList; 3. In class Main, (a) Add the following method to the main
1. Create an Intellij project
2. Add this import to Main.java:
import java.util.ArrayList;
3. In class Main,
(a) Add the following method to the main class. When called, it will insert pseudo-random integer values into the ArrayList passed via the parameter al. The number of values inserted is determined by the value passed to the parameter size.
public static void Pack(ArrayList
Random r = new Random();
for (int i=0; i al.add(r.nextInt(size)); } (b) In method main: i. Create two ArrayList ii. Ask the user for the number of integers to place in the ArrayLists and, in turn, pass the two ArrayList iii. Create a third ArrayList iv. Output the number of common values and the common values stored in the third ArrayList
Step 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