joshualoz3034 joshualoz3034
  • 23-05-2018
  • Computers and Technology
contestada

Write the code to compute and output how many times the value 99 is found in an array of integers named numbers

Respuesta :

kaevras
kaevras kaevras
  • 24-05-2018
Thank you for being the rare question where you actually provide what language you want your answer in; I approve, and encourage this.

In Java, the following will work.
I made it a bit more versatile to work with others numbers, other than 99, if you so please (if not, just hardcode the 99 in yourself).

// Example list - fill this with numbers yourself.
ArrayList<Integer> nums = new ArrayList<>();
int n = 99;
int count = (int)nums.stream().filter(i -> i == n).count();
System.out.println(n + " occurences.");
Answer Link

Otras preguntas

what are the benefits of using a graph? select all that apply.
what is 5.25 - 2 to the third power minus -7.8
0.5,1/5,0.35,12/35,4/5 least to greatest
If the population of a country grows at a rate of approximately 5 percent per year, the number of years required for the population to double is closest to
I am confused on how this table works
Calculate the photon energy (in joules) for the light emitted from the hydrogen atom if ninitial = 4 and nfinal = 2.
What is changed when matter undergoes a physical change? Give an example to explain your answer.
What influences the strength of an electric field?
Find the extreme values of f on the region described by the inequality. f(x, y) = 2x2 + 3y2 − 4x − 2, x2 + y2 ≤ 16
Select ALL correct answers! Which of the following are examples of "situational" irony? A fire hydrant on fire Mickey Mouse screaming with fear at the sight of