Let's Get Takeout Task 8 Help

Hi all,

I had nearly finished this coding assessment when I transferred the files into my main IDE and I got an error with the following code:

import java.util.ArrayList;
import java.util.List;

public class FoodMenu {
  private List<Food> menu = new ArrayList<Food>();

  public FoodMenu() {
    menu.add(Food("Burger", "with cheese and salad", 12));
    menu.add(Food("Hot Dog", "with caramelised onions", 10));
    menu.add(Food("Pizza", "with custom toppings", 8));

  // numbers have not been added to the method yet
  @ Override
  public String toString() {
    StringBuilder sb = new StringBuilder();
    for (Food item: menu) {
    return sb.toString();

  public Food getFood(int index) {
    if (index >= 1 && index < menu.size() + 1) {
      return menu.get(index);
    } else {
      return null;

  public Food getLowestCostFood() {
    int lowest = menu.get(0).getPrice(); // returns the price of index 0
    Food cheapest = null;
    for (Food item: menu) {
      if (item.getPrice() < lowest) {
        cheapest = item; // sets cheapest to the current lowest value
        lowest = item.getPrice(); // updates lowest to the new lowest value
      } else {
    return cheapest;

My IDE is considering the Food object as an undefined method, so was just wondering what I am doing wrong here? Feel free to point out any other errors I haven’t picked up on.

Any advice would be super helpful.

I guess you could try compiling those in the command line with both file names.
javac Food.java FoodMenu.java