Question: Lab Goal This lab was designed to introduce and demonstrate how to use an ArrayList. Lab Description: Create a method that will receive an integer

 Lab Goal This lab was designed to introduce and demonstrate howto use an ArrayList. Lab Description: Create a method that will receivean integer parameter and then return an ArrayList that contains all of

Lab Goal This lab was designed to introduce and demonstrate how to use an ArrayList. Lab Description: Create a method that will receive an integer parameter and then return an ArrayList that contains all of the number's factors, excluding 1 and itself. Create a 2ne method that will remove all numbers from its Aravlist parameter that are not composite numbers. Composite numbers are divisible by 1 itself, and must have at least 1 other positive factor. You will need to use % to determine if a number is a factor public class ArravListFunHouse public staticaintege> getliatofFastoraint numbe) you will add code public atatic void keepOasiteumbera Listsinteger> I you will add code Files Needed Sample Data ArrayListFunHouse.java ArrayListFunHouseRunner.java 100 762 2 68 9 10 12 13 15 17 24 55 66 78 77 79 Sample Output r 3] [2, 5, 10, 25] [2, 4, 5, 10, 20, 25, 501 2, 3, 6,127, 254, 381) Original List 2, 6, 8, 9, 10, 12, 13, 15, 17, 24, 55, 66, 78, 77, 791 Composite List , 8, 9, 10, 12, 15, 24, 55, 66, 78, 771 import java.util.Scanner; import java.util.List; import java.util.ArrayList; import java.util.collections; import static java.lang.System.*; public class ArrayListFunHouse public static ArrayList getListofFactors(int number) return null; public static void keepOnlyCompositeNumbers ( List nums) import java.util.Scanner; import java.util.List; import java.util.Arrays; import java.util.ArrayList; import java.util.collections import static java.lang.System.* public class ArrayListFunHouseRunner public static void main String args) System.out.println(ArrayListFunHouse.getListofFactors (9)); System.out.println (ArrayListFunHouse.getListofFactors (23)) System.out.println (ArrayListFunHouse.getListofFactors (50)) System.out.println (ArrayListFunHouse.getListofFactors (100)) System.out.println (ArrayListFunHouse.getListofFactors (762)) IntegerI nums-2,6,8,9,10,12,13,15,17,24,55, 66,78,77,79); List list = new ArrayList ( Arrays.asList(nums) ); System.out.println( list ArrayListFunHouse.keepOnlyCompositeNumbers( System . out . printin( st ); st )

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!