Problem 1: Example Menu

Task 1: Print the 2D array

In the 2D array below we have a list of different foods. Each row is the same type. For an example, row 1 is an array of main courses. Row 2 is an array of drinks and row 3 is an array of desserts.

String[][] menu = {    
                    { "Hamburger", "Pasta", "Steak", "Tacos" },
                    { "Cola", "Sprite", "Pepsi", "Fanta" },
                    { "Pudding", "Ice Cream", "Mochi", "Cake" }
                  };

Use what you have learned to print out the array!

Launch Replit

Task 2: Search for an item

The manager wants to know if there is a specific item in the menu. Build a search method that returns true or false if the item is in the menu or not.

  1. Remember to check every element in the row and column!
  2. What value type does this return?

Launch Replit