Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Required Skills Inventory . Write a method that take a arguments and returns no value Write a method that takes an array as an


image

Required Skills Inventory . Write a method that take a arguments and returns no value Write a method that takes an array as an argument Use parameter variables in a method body Use a loop to get the computer to repeat instructions Use a loop to iterate over the elements of an array Use an if statement to get the computer to make a decision Use a variable to keep a count Problem Description and Given Info Write (define) a public static method named countGreater Than, that takes an array of int, and an int as arguments and returns (as an int) a count of the number of values in the argument array that are greater than the second argument value. For example, given the following Array declaration and instantiation: int[] myArray = {1, 22, 333, 400, 5005, 9}; countGreater Than (myArray, 200) should return 3 countGreater Than (myArray, 9999) should return 0 You may wish to write some additional code to test your method. Helpful Hints:* Your method will need to use a loop to iterate through the elements in the array For each element in the array, your method must compare this value to the second argument value (i.e. we must decide if this value should be counted) If the array value meets the criteria (i.e. it is greater than the second argument value), then you must count it The last thing your method must do is to return the count Need Help? Additional help resources are available by clicking on the words "Need Help?" at the bottom of this page, and search for help or ask a question! 426022 2702406.qx3zqy7 LAB ACTIVITY 10.32.1: Array Count Greater Than (Individual Assignment) 1 public class Main { 2 3 4 5 6 7 8 Main.java public static void main(String[]args) { // you may wish to write some code in this main method // to test your method. } // define your method(s) here below 0/100 Load default template....

Step by Step Solution

3.36 Rating (128 Votes )

There are 3 Steps involved in it

Step: 1

The prompt you provided includes an image from a course assignment that asks you to write a method named countGreaterThan that takes an array of integ... blur-text-image

Get Instant Access with AI-Powered Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Structures and Algorithm Analysis in Java

Authors: Mark A. Weiss

3rd edition

132576279, 978-0132576277

More Books

Students also viewed these Programming questions

Question

Extend the classic cuckoo hash table to use d hash functions.

Answered: 1 week ago