Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

10.32 Array Count Greater Than (Individual Assignment) This is an Individual Assignment. You must complete this assignment on your own. - Do not collaborate or

image text in transcribed
image text in transcribed
10.32 Array Count Greater Than (Individual Assignment) This is an Individual Assignment. You must complete this assignment on your own. - Do not collaborate or share code with other students. - Do not copy and paste code from anywhere. - Do not use any resources outside of those provided in the course materials. - Do not use any language features that have not been covered to this point in the course materials, - If you get stuck or need help, please use the help systems provided in this course. 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 Copyright 2021 Arizona State University - THIS CONTENT IS PROTECTED AND MAY NOT BE SHARED, UPLOADED, SOLD, OR DISTRIBUTED. Problem Description and Given Info Write (define) a public static method named countGreaterThan, 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: fnt[]myArray=(1,22,333,400,5005,9);. countGreaterThan (myAr ray, 200) should return 3 Problem Description and Given Info Write (define) a public static method named countGreaterThan, 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 Afray declaration and instantiation: int[]myArray=(1,22,333,400,5005,9); countGreaterThan (myArray, 200) should return 3 countGreaterThan (myArray, 9999) should return 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 argurnent value (ie 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

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

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

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

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

Database Management An Organizational Perspective

Authors: Richard T. Watson

1st Edition

0471305340, 978-0471305347

More Books

Students also viewed these Databases questions