Question: 4) Create a method with the following header public static boolean factors(int num, int[] factorArray) The method factors takes as parameters an integer num and

 4) Create a method with the following header public static boolean

4) Create a method with the following header public static boolean factors(int num, int[] factorArray) The method factors takes as parameters an integer num and an integer array factorArray. You are going to determine if the integer num is evenly divisible by all the integers in factorArray. In other words, the remainder of num divided by each integer in factorArray is 0. If num is evenly divisible by all the integers in the array, the method factors returns true. Otherwise, it returns false. You will need to define the integer and factors array in the main method. Say you have the following conditions in the main method: int number = 102; int[] numArray = {2, 3, 6, 51}; When you call the method factors with this information: factors(number, numArray) The method factors should return true. If you have the following conditions in main: int number = 144; int[] numArray = {3, 12, 24, 48, 71); When you call the method factors with this information: factors(number, numArray) The method factors should return true. The method factors should work with any value of number and any number of elements in the array. You need to ensure your program has no syntax, run-time, or logic errors. You need to compile and run your program with different data sets

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!