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>