Menu
support@authoritypapers.com
+1(805) 568 7317

complete the method named countoccurs in the class named arrayops java there are two 5195927

Complete the method, named countOccurs, in the class named ArrayOps.java. There are two parameters to this method: the first is an integer array, and the second parameter is a single integer.

This method counts the number of occurrences of the given integer (second) parameter within the array of integers. This integer count is the return value. For example, if the array contains four integers: 23, 31, 17, 23, and the second parameter is the value 23, then the value returned would be 2, as 23 occurs twice within that array. However, if the second parameter is the value 42, the value returned would be zero, as the array does not contain the integer 42.

Complete the following code:

public class ArrayOps { /** This method goes through the array of integers identified by the first parameter, while counting the number of occurrences of the second parameter, a single integer, within the array. @param theArray, an array of integers @param theChar, an integer whose occurrences within the array need to be counted @ return, the count of the occurrences of the integer represented by the second parameter in the array of integers. */ public static int countOccurs(int[] theArray, int theInt) { int count = 0; // loop though theArray, counting occurrences of theInt // your work here // return count of occurrences // your work here } }

"Order a similar paper and get 15% discount on your first order with us
Use the following coupon
"GET15"

Order Now