Question: Please help me to solve this code check /** * Processing Arrays with Loops * * @author * @version */ public class PS15A { /**
Please help me to solve this code check
/** * Processing Arrays with Loops * * @author * @version */ public class PS15A { /** * Write the method named arrayCount9(). * * Given an array of ints, return the number of 9s in the array. * * Examples: * arrayCount9({1, 2, 9}) returns 1 * arrayCount9({1, 9, 9}) returns 2 * arrayCount9({1, 9, 9, 3, 9}) returns 3 * * @param nums the original array to process. * @return the number of 9s in the array. */ // TODO - Write the arrayCount9 method here /** * Write the method named array442(). * * Given an array of ints, return the number of times * that two 4's are next to each other in the array. * Also count instances where the second "4" is actually a 2. * * Examples: * array442({4, 4, 3}) returns 1 * array442({4, 4, 3, 4}) returns 1 * array442({4, 2, 4, 6}) returns 1 */ // TODO - Write the array667 method here /** * Write the method sum13(). * * Return the sum of the numbers in the array, * returning 0 for an empty array. Except the number * 13 is very unlucky, so it does not count, and * numbers that come immediately after a 13 also * do not count. * * Examples: * sum13({1, 2, 2, 1}) returns 6 * sum13({1, 1}) returns 2 * sum13({1, 2, 2, 1, 13}) returns 6 * * @param nums the array to process. * @return the sum except for 13s and numbers following. */ // TODO - Write the sum13 method here. }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
