Question: I don't understand the Java program and the output. Would you mind to explain the program step by step with comment? Question 5 [5 marks]

 I don't understand the Java program and the output. Would you

mind to explain the program step by step with comment? Question 5

I don't understand the Java program and the output.

Would you mind to explain the program step by step with comment?

Question 5 [5 marks] Consider the following method of a class Mystery public int mystery(double[] numbers, double aValue) { int c = 0; for (int i=0; i= aValue) { C++; } } return c; } The following variables have been declared: Mystery m = new Mystery(); double[] age = {15, 20, 50, 30}; What is the output of the following statement? System.out.println(m.mystery(age, 20)); (b) What is the function of the method mystery()? If the array studentAge, whose elements are of type double, contains the ages of HKMU students. Write a statement to output the percentage of students whose ages are between 20 to just below 30 using the method mystery()? [5] Question 5 [5 marks] (a) (b) (c) 3 Count the number of elements in the array numbers greater than or equal to aValue. System.out.println((m.mystery(studentAge, 20) m.mystery(studentAge, 30)) / (double) studentAge.length * 100 + "%")

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