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
Gloria is in her sophomore year of college and works part time. She has assignments saved on her home computer, her aunt's lapto
Tanzania [10]
I think this answer, "<span>Upload all existing documents to a cloud-based program," is correct. Hope I helped!!</span>
4 0
3 years ago
Read 2 more answers
___ is the technology used by smart phones to send text messages.
Vladimir79 [104]
The technology used for sending text messages is MMS. =)
5 0
3 years ago
25 points select 3 options!!!!!!!!!!!!!!!!!!!!!!!!!
STALIN [3.7K]
A, B , and E sorry if I’m wrong
4 0
3 years ago
Electronic files created on a computer using programs such as word software are considered to be
nika2105 [10]

From the Page Layout tab, click Margins. Select Custom Margins... from the drop-down menu. Selecting Custom Margins...

The Page Setup dialog box will appear.

Adjust the values for each margin, then click OK. The Page Setup dialog box.

The margins of the document will be changed

6 0
4 years ago
An example of human API would be when:
liraira [26]

Answer:A

Explanation:Apex

8 0
3 years ago
Read 2 more answers
Other questions:
  • Write a program that asks how many tickets for each class of seats were sold, then displays the amount of income generated from
    10·1 answer
  • Which type of computer do dedicated gamers and video editors prefer?​
    11·1 answer
  • The manufacturer doesn't need it the buyer doesn't want it the user doesn't know they're using it
    6·1 answer
  • Why do generated backup scripts usually include backticks around names such as database names and column names?
    5·1 answer
  • Digital Subscriber Line (DSL) is the only Internet connection option available for a small office in the middle of nowhere. Whic
    15·1 answer
  • Astrid's computer screen suddenly says that all files are now locked until money is transferred to a specific account, at which
    11·1 answer
  • What is the safest way to pay online​
    13·2 answers
  • True/false
    8·1 answer
  • Consider we have n pointers that need to be swizzled, and swizzling one point will take time t on average. Suppose that if we sw
    11·1 answer
  • During slide show mode, hitting the B key will do which of these things? end your presentation move back one page move to the fi
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!