Lab: Map – Processing Pizza Orders
Objective
In this lab you will practice using the Map component by implementing
a simple prototype for the billing application of a new chain of pizza
delivery stores.
Setup
Follow these steps to set up a project for this lab.
- Create a new Eclipse project by copying
ProjectTemplate. Name the new projectPizzaOrderManager. - Open the
srcfolder of this project and then open(default package). As a starting point you can use any of the Java files. Rename itPizzaOrderManagerand delete the other files from the project. - Follow the link to
PizzaOrderManager.java, select all the code on that page and copy it to the clipboard; then open thePizzaOrderManager.javafile in Eclipse and paste the code to replace the file contents. Save your file. - Save the following three files to the
datafolder 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
- First carefully look through the file
PizzaOrderManager.javaand the main method in particular. You may also want to look at the three text files you created in thedatafolder to make sure you understand the format for these files. - Complete the given class by pasting the bodies of the
getPriceMapandgetOneOrderstatic methods you wrote for the homework into thePizzaOrderManager.javafile, and complete the body of theputPricestatic method. - Run the program and check that the output matches the expected output based on the input files provided.
Additional Activities
- Create a JUnit test fixture for the
PizzaOrderManagerclass and provide test cases for the static methods you implemented.