Question: FoodListInterface.java specifies a Java interface for an ADT that maintains a list of foods, dishes or meals. This interface includes two operations: add(String food) add

FoodListInterface.java specifies a Java interface for an ADT that maintains a list of foods, dishes or meals. This interface includes two operations:

  • add(String food) add the name of a food, dish or meal to the list
  • onTheMenu(String food) check if a given food item is on the list

Develop three implementations of this interface, each with a different underlying data structure:

  • Array
  • Linked list
  • ArrayList from the java.util package (a Java Collections Framework class)

Each implementation is a separate class, and each of these classes is to include a toString() method to list out the food items, one per line.

The source code for the interface is provided in the foodListpackage in the attached Eclipse project export file for this assignment. The linked list implementation must use the LLStringNode.java class provided in the foodList package; do not use the LinkedList class from the java.util package.

To earn full credit you must make use of appropriate ArrayListmethods to efficiently develop the food list ADT based on that data structure, along with an enhanced for loop to traverse the list of foods for the toString() method.

In addition to the three ADT classes, create a single Java program i.e., a Java class with a main() method to test each of the implementations. For each implementation:

  • Instantiate a list object and add seven of your favorite things to eat;
  • Using System.out.println(), display the list of food items;
  • Use the onThisList() method to test whether fettuccine alfredo is on your list, and report out the result; and
  • Use the onThisList() method to test another food, and report out that result make sure to use a food, dish or meal that produces the opposite result from the first test.

Submit the following items:

  • An Eclipse project export with all of your source code
  • Overall project description, as described in the Programming Projects General Requirements; note that simple .txt files are not acceptable

ProgProjOne.zip

ProgProjOneHeadStart.zip

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!