Lab: Map – Processing Pizza Orders


Objective

In this lab you will practice using the Map component by implementing a simple prototype for the telephone operator's console of a new chain of pizza delivery stores.

Setup

Follow these steps to set up a project for this lab.

  1. Create a new Eclipse project by copying ProjectTemplate. Name the new project PizzaOrderManager.
  2. Open the src folder of this project and then open (default package). As a starting point you can use any of the Java files. Rename it PizzaOrderManager and delete the other files from the project.
  3. Follow the link to PizzaOrderManager.java, select all the code on that page and copy it to the clipboard; then open the PizzaOrderManager.java file in Eclipse and paste the code to replace the file contents. Save your file.
  4. Save the following three files to the data folder in your project (in your browser, you should be able to accomplish that by right clicking on each link and selecting Save Link As... or Save target as... or the equivalent entry from the contextual menu):

Method

  1. First carefully look through the file PizzaOrderManager.java and the main method in particular. You may also want to look at the three text files you created in the data folder to make sure you understand the format for these files.
  2. Complete the given class by pasting the bodies of the getPriceMap and getOneOrder static methods you wrote for the homework into the PizzaOrderManager.java file, and complete the body of the putPrice static method.
  3. Run the program and check that the output matches the expected output based on the input files provided.

Additional Activities

  1. Create a JUnit test fixture for the PizzaOrderManager class and provide test cases for the static methods you implemented.