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
Alja [10]
3 years ago
14

g Create a package named lab7 (no spaces, ALL in lowercase) where you will place your lab files. Write a class FilterWith with a

method called filterRange that accepts an ArrayList of integers and two integer values min and max as parameters and removes all elements whose values are in the range min through max (inclusive). For example, if a variable called list stores the values [4, 7, 9, 2, 7, 7, 5, 3, 5, 1, 7, 8, 6, 7], the call of filterRange(list, 5, 7); should remove all values between 5 and 7, changing the list to store [4, 9, 2, 3, 1, 8]. If no elements in range min-max are found in the list, or if the list is initially empty, the list's contents are unchanged. Create an application that creates an object of FilterWith and invokes the filterRange method and show the results
Computers and Technology
1 answer:
sweet [91]3 years ago
3 0

Answer:

See explaination

Explanation:

import java.util.ArrayList;

import java.util.Scanner;

public class ListFilter

{

public static void filterRange(ArrayList<Integer> list,int min, int max)

{

ArrayList<Integer> listNew=new ArrayList<Integer>();

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

{

if(list.get(i)>=min && list.get(i)<=max) //Checking if element is between min and max

{

listNew.add(list.get(i));

}

}

list.removeAll(listNew); //removing all elements from list.

}

public static void main(String[] args)

{

ArrayList<Integer> list=new ArrayList<Integer>();

list.add(4);

list.add(7);

list.add(9);

list.add(2);

list.add(7);

list.add(7);

list.add(5);

list.add(3);

list.add(5);

list.add(1);

list.add(7);

list.add(8);

list.add(6);

list.add(7);

Scanner sc=new Scanner(System.in);

System.out.println("Enter min : ");

int min=sc.nextInt();

System.out.println("Enter Max : ");

int max= sc.nextInt();

filterRange(list, min, max);

//Displaying new List

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

{

System.out.print(list.get(i)+" ");

}

}

}

You might be interested in
A wireless networking technician has completed a survey of a wireless network and documented the detected signal strengths in va
spayn [35]

Answer: Heat map

Explanation:

heat map uses colouring technique with different ranges of colour. This colours differs from with the associated network signal strength of that area.So when an technician completes a survey later he can know which area has a better signal strength and areas having poor network strength from the heat map.

5 0
3 years ago
ASAP PLZ!!! Select the correct answer.
rodikova [14]

Answer:

after data is appropriately processed, transformed and stored, it is subject to data mining. This step covers data analysis methods including parametric and non-parametric methods, and machine-learning algorithms. A good starting point for data mining is data visualization.

Explanation:

3 0
3 years ago
Read 2 more answers
What is the main differnace between piracy and hacking. please help and explane it in more than 200 words. A small essay would b
Elina [12.6K]

Answer:

Piracy is illegally copying and distributing content and, in most cases, making a profit off of each transaction. Hacking is the act of breaking down and through decurity measure to access information that would otherwise be inaccessible. Usually done for bragging rights as opposed to profit.

Explanation:

3 0
3 years ago
Jeremy wants to run a program file from the command prompt. Which of the following should Jeremy type in the command prompt wind
atroni [7]
Path name , so it could be like C:\Windows\system32\mspaint.exe

8 0
4 years ago
Read 2 more answers
you are part of a sales group that has been asked to give a presentation before you begin, what should your group do?
Rom4ik [11]

Your team should all meet and discuse the topic of the presentation making sure everyone has a clear understanding of the topic and who is going to go over the different parts of the presentation and in what order

8 0
3 years ago
Read 2 more answers
Other questions:
  • All of the following are tips for the Aspire English tests except
    15·1 answer
  • Which application requires knowlodge of html or javascript to produce a website
    11·1 answer
  • Exampels of semantic tags ?​
    7·1 answer
  • java A palindrome is a word or a phrase that is the same when read both forward and backward. Examples are: "bob," "sees," or "n
    5·1 answer
  • Name of the electrical tool and their classification
    10·1 answer
  • In Python in order for a sort to work, which of the following is required?
    14·2 answers
  • WHAT ARE SOME PROS AND CONS OF HYDROGEN FUELL CELLS
    11·1 answer
  • What is the full meaning of the following word,1. HTTP,2. CPU,3. WYSIWYG and 4. PC​
    8·2 answers
  • which server edition doesn't support any server roles that you would typically use with standard version
    6·1 answer
  • In terms of shaping the future of cybersecurity in the United States, how influential do you think the Russian hacking efforts o
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!