Question: 1 public class NumEqual { 2 / / Write a method named numEqual which takes two parameters: 3 / / - An array of integers

1 public class NumEqual {
2// Write a method named numEqual which takes two parameters:
3//- An array of integers
4//- A single integer
5//
6// This method will return the number of times the single
7// integer appears in the array of integers. For example,
8// if the array contained the elements:
9//
10//1,2,2,3,2,4
11//
12//...and we were given 2 as the single integer, then this
13// would return 3, because 2 appears in the above array
14// three times.
15//
16// As another example, consider the following array:
17//
18//1,2,3,4,5,6
19//
20// If the single integer given were 7, this would return
21//0, since 7 does not appear in the above array.
22//
23// If given an empty array, this should return 0, since
24// no elements are contained in an empty array.
25//
26// The next portion will require you to write a test
27// suite for the above code. If you want, you can
28// define a main method that does whatever you'd like
29// to informally test numEqual. You do NOT need
30// to define main, and I will not look at main during
31// grading.

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!