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
A user complains that his computer automatically reboots after a short period of time. Which of the following computer component
Oduvanchick [21]

Answer:

The answer is "option a".

Explanation:

To resolve the automatic reboot problem we must change the CPU cooling fan because if we don't change a computer fan so, it will be heated and damage other components. This cooling fan used inside the CPU. It expels warm air from inside and moves air across the particular component. and other options are not correct that can be described as:

  • In option b, power supply is used to turn on the computer. It is not used to solve the reboot problem.
  • In option c,  Motherboard is to serve as the base upon which a computer's components are built.  
  • In option d, It is primarily used to store the data.  

6 0
3 years ago
Imagine you are responsible for making a presentation that includes a representation of the logic flow through a process. You un
svetoff [14.1K]

Answer:

find reliable resources

Explanation:

if you find reliable resources, than you might able to have more help i know im not answering..but im trynna help

3 0
3 years ago
In HTML, an opening tag and its closing tag must appear on the same line. True Or False​
DaniilM [7]

Answer:

the answer is true, you cannot break the element apart EVERR!!!!!

3 0
3 years ago
Mike has never used a slide software before, but he needs to create a presentation by the end of the week. what recourse would b
ankoles [38]

This is an incomplete question. The complete question is given below:

Mike has never used slide presentation software before but he needs to create a presentation by the end of the week what resource would be most helpful to mike

a. The 350-page printed manual from the slide presentation software publisher

b. A free tutorial the slide presentation software publisher has posted on the company website

c. A trouble-shooting website created by a third party

d. The 350-page online manual from the slide presentation software publisher

Answer:

b - A free tutorial the slide presentation software publisher has posted on the company website

Explanation:

As Mike has a short time and no prior experience with a slide software, then in this scenario, the best, simplest and fastest way to learn and create a presentation a free tutorial which the slide presentation software publisher has posted on the company website  as this is the same company that has created this particular software so he can be rest-assured that the resource he is relying on is authentic and up-to-date with information on latest features.

Moreover, it's efficient and quick way to learn from a free tutorial rather than from 350-page printed or online manual especially for a beginner.

Besides, his purpose is to create the presentation using the software and not trouble-shooting so trouble-shooting website created by a third party is not useful for him and it also might not be authentic or updated as well.

6 0
3 years ago
Windows needs free space on the hard drive for normal operation, for defragmenting the drive, for burning CDs and DVDs, and for
REY [17]

Answer:

True

Explanation:

Windows writes temporary files to the hard disk which it uses as a cache during normal operation. These files are usually deleted automatically after the windows operation has been completed. If there is no free disk space available, some windows operations will fail to start and others will stop working

3 0
3 years ago
Other questions:
  • Explain possible consequences if someone is issued with a fraudulent licence
    6·1 answer
  • What is the meaning for science?
    14·1 answer
  • The local emergency manager has the responsibility for coordinating emergency management programs and activities. A local emerge
    7·1 answer
  • #We've started a recursive function below called #measure_string that should take in one string parameter, #myStr, and returns i
    5·1 answer
  • Hunter took his sick puppy to Jade to get medication. Jade is
    14·2 answers
  • Use induction on n to prove that fir all n&gt;=2, 2^n+3^n&lt;5^n
    11·1 answer
  • What is an Apple Pen?
    5·2 answers
  • In the context of computer and network security, _____ means that a system must not allow the disclosing of information by anyon
    10·1 answer
  • In binary, the second digit from the right is multiplied by the first power of two, and the _____ digit from the right is multip
    10·2 answers
  • What is a complier in computers
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!