0
/ 50
For this question you will be using FoodItem
objects and one GroceryBag
object.
Here's what the FoodItem class looks like:
public class...
For this question you will be using FoodItem
objects and one GroceryBag
object.
Here's what the FoodItem class looks like:
public class FoodItem
{
private double price;
public FoodItem(double p)
{
this.price = p;
}
public double getPrice()
{
return price;
}
}
The method below should calculate the total price of all FoodItem
s in the bag.
Finish the body of this for-each loop to make that happen!
Your feedback will appear here when you check your answer.