Programming Language

posted by .

Create a method called countSelected, which takes an array of integers and an integer as input parameters and returns the number of occurences of the integer in the array.

data:{2, 1, 1, 8, 1, 0}
==> 3

public int countSelected (int[] data, int select) {

Respond to this Question

First Name
School Subject
Your Answer

Similar Questions

  1. C++ Programming

    Design and create a class named Stats that has an array of 12 doubles as one of its member variables. The values in the array should be set by making 12 calls to a public member function named setValue that accepts two arguments, an …
  2. college

    Write a C++ program to fill an array with 6 numbers, and then reverse the values of this array. Note: By using a function with two parameters with the name of the array and the size of this array.
  3. computer science

    Create a method called countZeros, which takes an integer array as an input parameter and returns the number of zero entries in the array
  4. programming

    How do i read in a vector of integers with a space inbetween (i.e. 0 1 2 3) and make it an integer array?
  5. computer science

    9.10: Reverse Array Write a function that accepts an int array and the array’s size as arguments. The function should create a copy of the array, except that the element values should be reversed in the copy. The function should …
  6. Computer Science

    Write a class “Program1” that has the method “allLess” (below) that receives two arrays of integers and returns true if each element in the first array is less than the element at the same index in the second array. For example, …
  7. programming

    Write a program which allows user to enter 10 student names and scores for Java programming 1 and Java programming 2. Allow user to choose which course they want to enter the record for. Use the loop to ask input from user. The program …
  8. computer code

    Create a Flowchart and pseudocode. Create a class whose main method creates three arrays. The first array will contain five kinds of flowers - petunia, pansy, rose, violet, and carnation. The second array will contain the cost of each …
  9. programming

    A. Write a program which reads an array of up to 200 integers from input and then does all the following in order 1. searches the array for a specific integer given by the user and outputs its position in the array; 2. outputs the …
  10. c programming

    Write a program to read from a file called "input.txt" information about 5 workers. Each line would contain two values respectively, an employee ID and the employee's monthly salary. Assume that the data from the input file is stored …

More Similar Questions