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
Which of the following is the system of rules and structure governing
Whitepunk [10]

The system of rules and structure which governs language is generally referred to as: C. grammar.

<h3>What is language?</h3>

A language simply refers to a structured system of communication through which living organisms, especially humans share information among themselves, especially through the use of spoken words and sounds.

In English language, grammar is the system of rules and structure which governs the use and composition of language.

Read more on language here: brainly.com/question/781903

#SPJ1

8 0
1 year ago
Is there such a thing as an ethical reason for unauthorized access into a computer system?
Anastaziya [24]
Of course there is. On a simple level, consider a parent trying to locate their missing child. Someone might break into their social media accounts to see if there are messages that might help determine their whereabouts.

Consider a website hosting inappropriate pictures of children. Breaking into the server hosting the files and removing them is 100% ethical. 

I'm sure you can think of more examples. 
7 0
3 years ago
A hub transmits all incoming messages to all of its ports except the port where the messages came in. A switch usually sends mes
leonid [27]

Answer:

MAC Addresses (Destination and Source MAC address)

Explanation:

A switch has 3 primary functions:

  • Forward frames
  • Learn addresses
  • Avoid loops

An Ethernet frame has the header, data and trailer and there are two specific fields in the header that helps the switch to know where to send data in future transmissions.

  • destination MAC address
  • source MAC address

every Ethernet frame has this and when the frame hits a switch or any device, any device can look at it ( an Ethernet frame ) and know where it is suppose to go and where it came from.

Every switch has a MAC address table where it stores MAC addresses of different computers on the network.

Example:

When a PC1 sends a frame to PC2 through a switch, the switch looks at the header of the Ethernet frame for the source mac address and adds the source MAC address to its MAC address table and also the port that it came through.

simply put:

A switch looks at the source MAC address to see if it knows it already, if it does. Great! no need to add it again to it's address table.

If it doesn't, it adds it's source address and the port that the frame came from.

This basically how the switch populates its MAC address table.

3 0
3 years ago
Read 2 more answers
Two machines can finish a job in StartFraction 20 Over 9 EndFraction hours. Working​ alone, one machine would take one hour long
Alborosie

<em><u>Answer</u></em>

5 hours

<em><u>Explanation</u></em>

The two working together can finish a job in

\frac{20}{9}  \: hours

Also, working alone, one machine would take one hour longer than the other to complete the same job.

Let the slower machine working alone take x hours. Then the faster machine takes x-1 hours to complete the same task working alone.

Their combined rate in terms of x is

\frac{1}{x}    +  \frac{1}{x - 1}

This should be equal to 20/9 hours.

\frac{1}{x}  +  \frac{1}{x - 1}  =  \frac{9}{20}

Multiply through by;

20x(x - 1) \times \frac{1}{x}  +20x(x - 1) \times   \frac{1}{x - 1}  =  20x(x - 1) \times \frac{9}{0}

20(x - 1)  +20x = 9x(x - 1)

20x - 20+20x = 9{x}^{2}  - 9x

9{x}^{2}  - 9x - 20x - 20x + 20= 0

9{x}^{2}  - 49x  + 20= 0

Factor to get:

(9x - 4)(x - 5) = 0

x =  \frac{4}{9}  \: or \: x = 5

It is not feasible for the slower machine to complete the work alone in 4/9 hours if the two will finish in 20/9 hours.

Therefore the slower finish in 5 hours.

8 0
3 years ago
Major findings of evolution of computers
Elis [28]

Answer:

twitt

Explanation:

3 0
3 years ago
Other questions:
  • Americans overwhelmingly support organ and tissue donation.
    5·1 answer
  • Word processing, presentation, photo editing, and video games are all types of what?
    9·2 answers
  • A utility program that makes a copy of all files or selected files that are in the libraries is called ______
    6·1 answer
  • Describe five examples of civil engineering projects.
    6·1 answer
  • the tool that is used on the form to display text that the user cannot change is a. textbox b. label c. button​
    9·1 answer
  • A program that allows employees to choose their starting and ending times, as long as they are at work during a specified core p
    8·1 answer
  • What are the basic tasks performed by an operating system?​
    5·1 answer
  • Give a common business example that mimics the differences between a shared
    5·1 answer
  • Which keyboard shortcut would you press to copy cells that are selected in a spreadsheet?
    14·1 answer
  • even if we reach that state where an AI can behave as human does,how do we measure if AI is acting like a human?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!