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
lidiya [134]
3 years ago
6

Write a method called removeHighPrice that will go through a provided ArrayList called prices and removes the first price that i

s more than $5.00 and return the new ArrayList. If a price over $5 is not found, it returns the original ArrayList.
Computers and Technology
1 answer:
Diano4ka-milaya [45]3 years ago
6 0

Answer:

The method written in Java is as follows:

public static ArrayList<Double> removeHighPrice (ArrayList<Double> prices){

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

     if(prices.get(i) > 5.00){

         prices.remove(i);  

         break;

     }

 }

 return(prices);  

 }

Explanation:

This line declares the method

public static ArrayList<Double> removeHighPrice (ArrayList<Double> prices){

This line iterates through the ArrayList named prices

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

This checks if current price is greater than 5

     if(prices.get(i) > 5.00){

If yes, the price is removed

         prices.remove(i);  

And the loop is terminated

         break;

     }

 }

This returns the ArrayList

 return(prices);  

 }

<em>I've added as an attachment, the complete program which includes the main method</em>

Download txt
You might be interested in
are designed to locate information based on the nature and meaning of Web content, not simple keyword matches Select one: a. Cra
san4es73 [151]

Answer: C. Semantic Search Engines

Explanation:

Semantic search is simply search with meaning. It is designed to locate information based on the nature and meaning of Web content, not simple keyword matches (like in lexical searches)

4 0
3 years ago
The ____ function displays the highest value in a range.
Monica [59]
Max()

------------------------------------------------------------
5 0
3 years ago
Read 2 more answers
¿Cuales son las empresas mas exitosas que aún usan hoja de cálculo? porfa es urgentee
dem82 [27]

Answer:excel

Explanation:

6 0
2 years ago
2. Name the three building blocks of design that pertain to form.
inna [77]

Answer:

Point, Line, Shape,Form, Color, Value, and Texture.

Explanation:

The elements of design, are the building blocks used by the designers to create the designs. ...

Point, Line, Shape,Form, Color, Value, and Texture.

3 0
3 years ago
Computer _____ begins with regular maintenance of the computer system such as firewalls, antivirus programs, defragmentation, de
Dima020 [189]
Computer checkup/maintenance. You forgot to mention windows updates, it is critical to perform that action as well cause of the recent ransomeware malware that is going around lately and Microsoft and other OS vendors yes even Apple have released patches to prevent it spreading even further. 
4 0
3 years ago
Other questions:
  • Every information systems (is) user has the right to a secure computing environment. this means that the
    12·1 answer
  • With a(n) ____ data table you can vary the value in one cell.
    5·1 answer
  • Which tool encrypts entire drives, rendering them unusable unless one possesses the correct key to unlock the drive?
    8·1 answer
  • Xml is used to format the structure and style of a web page. true or false
    7·1 answer
  • How do optical discs store data? select one:
    15·1 answer
  • What is blogging
    15·2 answers
  • How much does a dodge tomohawk cost for a used one?
    7·1 answer
  • Management of software development consist of?
    15·1 answer
  • ANSWER ASAP!!!!!!!!!!!!!
    7·2 answers
  • Do anyone know how to code like I need someone do a code for me?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!