X950: For-Each Loops 7

For this question you will be using FoodItem objects and one GroceryBag object.

public class FoodItem
{
    private double price;

    public FoodItem(double p)
    {
        this.price = p;
    }

    public double getPrice()
    {
        return price;
    }
}

The method below finds the food item with the highest price. Finish the body of this for-each loop to make that happen!

Your Answer:

Feedback

Your feedback will appear here when you check your answer.