Question: Consider an array of java int primitives such as the following: int scores [ ] = { 1 0 , 4 0 , - 1

Consider an array of java int primitives such as the following:
int scores[]={10,40,-10,50,70,65,54,23,82};
Write Java methods to do the following, using the given names. You may assume that the scores array in the parameter is not empty.
public int[] oddAndEven( int[] scores ):
This method takes the input array scores and returns an int[] array of size 2 in which the 0th value is the number of odd numbers in the array, and the 1st value is the number of even numbers in the array.
public boolean containsX( int[] scores, int x ):
This method returns true if the scores array contains the value x, and returns false if it does not.

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 Programming Questions!