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
Why is Brainly always deleting either my answers or my questions? I am putting nothing inappropriate in them. Can someone answer
Artist 52 [7]

Answer:

hey i do not know

Explanation:

3 0
4 years ago
Read 2 more answers
A device that allows multiple computers to communicate with each other is
Lapatulllka [165]

Answer:

A device that allows multiple computers to communicate with each other is

Network Hub.

Hope this helps!

:)

4 0
3 years ago
What features are provided by most GUIs?
PSYCHO15rus [73]

Windows is the answer

8 0
4 years ago
How to write my name in binary code ? Rivas
wel

Your name in binary would be "01010010 01101001 01110110 01100001 01110011"

3 0
3 years ago
Read 2 more answers
WILL GIVE BRAINLIEST AND HALLOWEEN CANDY!!!!!!!!!<br> who wants to talk?
Tamiku [17]
<h2>Sure, I wanna talk. (:      .........................</h2>
3 0
3 years ago
Other questions:
  • Ayuda no encuentro el concepto de estas tres preguntas: ¿para qué sirve la administración en la ofimatica o informática? ¿Que so
    13·1 answer
  • An Internet connection problem for customers is found to be outside a carrier's regional office. As a result, which area needs t
    9·1 answer
  • Answer the following questions:
    7·1 answer
  • A grade of B is worth Grade points<br><br><br> A) 3.0<br> B) 80<br> C)2.0<br> D)4.0
    13·2 answers
  • How are computers used in producing weather forecasts?
    8·1 answer
  • Which search engine do you prefer? Why
    15·2 answers
  • What does FLUX do when soldering an electrical joint?
    13·2 answers
  • Regarding computer protection, quarantining is defined as ________.
    9·1 answer
  • Please help thank you !!!
    7·2 answers
  • How many combinations of 1s and Os can we make with 6 place values?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!