1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
zhuklara [117]
3 years ago
6

Write a method named countInRange that accepts three parameters: an ArrayList of integers, a minimum and maximum integer, and re

turns the number of elements in the list within that range inclusive. For example, if the list v contains {28, 1, 17, 4, 41, 9, 59, 8, 31, 30, 25}, the call of countInRange(v, 10, 30) should return 4. If the list is empty, return 0. Do not modify the list that is passed in.
Computers and Technology
1 answer:
marissa [1.9K]3 years ago
6 0

Answer:

In Java:

The method is as follows:

public static int countInRange (ArrayList<Integer> MyList, int min, int max) {  

       int count = 0;

       for (int i = 0; i < MyList.size(); i++)  {

           if(MyList.get(i)>=min && MyList.get(i)<=max){

               count++;

           }  

       }

       return count;

 }

Explanation:

This defines the method

public static int countInRange (ArrayList<Integer> MyList, int min, int max) {

This declares and initializes count to 0  

       int count = 0;

This iterates through the ArrayList

       for (int i = 0; i < MyList.size(); i++)  {

This checks if current ArrayList element is between min and max (inclusive)

           if(MyList.get(i)>=min && MyList.get(i)<=max){

If yes, increase count by 1

               count++;

           }  

       }

This returns count

       return count;

 }

To call the method from main, use:

countInRange(v,m,n)

<em>Where v is the name of the ArrayList, m and n are the min and max respectively.</em>

You might be interested in
What is a mechanical gear and how does it work to create more power?
Neko [114]
Its a gear that is not turned manually and it can spin faster and longer than a manual gear.
5 0
3 years ago
If a large organization wants software that will benefit the entire organization—what's known as enterprise application software
Ganezh [65]

The organization must develop it specifically for the business in order to get the functionality required is True.

a) true

<u>Explanation:</u>

In software development industry it called as EAS. Where organizations required complete one solution and made most customizable with less cost effective.

Moreover to implement the same organizations has to spend less money for software development and hardware appliances. An organization has clear documented which specific their business requirements and their business future expansion.

Basically in organization from low grade employee to higher employee and meeting is arranged and understand system requirements and compiled as document which is circulated to higher official in organization for their final approval.

5 0
3 years ago
Hi question
lapo4ka [179]

Answer:

I believe it's 20% I could be wrong just thinking of it many teenagers don't really come out and say anything and are too afraid to tell anyone by possibly being wrong or putting themselves into more danger

6 0
3 years ago
Which is a credit card balance A. The amount of interest you must pay the credit card company B. The required minimum payment to
yKpoI14uk [10]
The best answer among the following choices would be the fourth option D).
7 0
3 years ago
If a fire should break out in your building, which of the following actions is NOT recommended?
quester [9]

C) Scream and run

you need to remain calm and carefully exit the building making sure you have everybody with you

6 0
4 years ago
Read 2 more answers
Other questions:
  • Ipv6 includes a native information security framework (ipsec) that provides both data and control packets. true false
    15·1 answer
  • Someone please help me with the right answer please
    13·1 answer
  • What is the hexadecimal and decimal equivalent of the binary number 110010001110
    5·1 answer
  • Print a message telling a user to press the letterToQuit key numPresses times to quit. End with newline. Ex: If letterToQuit = '
    12·1 answer
  • In case of an emergency, once you or someone already on the scene has contacted 9-1-1, the next thing to do is: A) Move them to
    9·2 answers
  • If I am working in a document and wish to follow a hyperlink, what should I do?
    7·1 answer
  • What information is displayed in the message header of a received message? Check all that apply.
    14·2 answers
  • 5 examples on technology identification
    9·1 answer
  • I will give brainliest to the best answer. what is a good screen recorder
    11·1 answer
  • Which of the following is the best way to add a lengthy explanation to Excel data without being limited to cell sizes and restri
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!