Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Please write code in Java 7) Given an integer array, the method below should return the count of the amount of odd numbers which occur
Please write code in Java
7) Given an integer array, the method below should return the count of the amount of odd numbers which occur in the array. Example calls and return values for the mothod are shown belowe Write the code needed for the method to work as intended. (feminder: use 22 to determine whether a number is divisible by 2 , or not) Your method MuST use a for-each loop. oddCount ({4,5,1,3,1,8,2,1)}5 oddCount ((4,2,2,2,2,2))0 oddCount ({3,5,10})2 public int oddCount ( intl] nums) f \} 8) Given an ArrayList of integers and an integer, the method below should return true if the integer occurs at least once in the ArrayList, or faise if the integer is not in the Arraylist. Example calls and return values for the method are shown below. Write the code needed for the method to work as intended. Your method MUST use a traditional for-loop. (NOT a for-each loop) findlt ({4,5,1},7) false findit ({4,2,4,3},4) true findlt ({1,2,3,4,5,6},6) true public boolean findit( ArrayList nums, int targetNum) f 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