Answered step by step
Verified Expert Solution
Link Copied!

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
image text in transcribed
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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 3 Lnai 9286

Authors: Albert Bifet ,Michael May ,Bianca Zadrozny ,Ricard Gavalda ,Dino Pedreschi ,Francesco Bonchi ,Jaime Cardoso ,Myra Spiliopoulou

1st Edition

3319234609, 978-3319234601

More Books

Students also viewed these Databases questions

Question

Write formal proposal requests.

Answered: 1 week ago

Question

Write an effective news release.

Answered: 1 week ago

Question

Identify the different types of proposals.

Answered: 1 week ago