FINALIZED 4/26/2010

Check back for updates to later releases. Final lab report will require you to devise and carry out comparative efficiency testing using the different releases of your code.

Introduction

For this project you will implement a Universal Product Code lookup. Your application will open a text file containing UPC data stored in comma separated value format. After reading in the UPC data, it will sort it, and then allow the user to lookup product information based on UPC code.

General Requirements

Release 0.7

You will be given the following files (download from Sakai):

  1. BarcodeLookup.java (a simple application class),
  2. Item.java (a data type to store individual UPC product records),
  3. GenericProductList.java (an interface).
  4. upc-medium.txt (a UPC data file)
  5. upc-small.txt (a smaller UPC data file)

You will write code for a class ProductList that implements the GenericProductList interface, based on your PArray with Quicksort from Lab 7.1 and 7.2. In that case, PArray stored Strings; you will rename PArray as ProductList and modify it to store objects of type Item. You will also need to add methods for finding, displaying, and deleting items from the list.

An example of expected output:

UNSORTED:
A = { 
        [ 0000000050340 |  | 12057 2X72X150 POULTRY NETTING ] 
        [ 0000000052214 | 12oz | Big Y Italian Bread ] 
        [ 0000000002288 | 18 oz | Winn Dixie Hand Lotion ] 
        [ 0000000001243 |  | CVS Photo 1-Hour 4x6 Finishing ] 
        [ 0000000046268 |  | JICAMA ] 
        [ 0000000049887 | 1 x 8 oz | Coca Cola:Diet Coke ] 
        [ 0000000002745 |  | sunglasses ] 
        [ 0000000003278 |  | ulta 3$ gift certificate  ] 
        [ 0000000001601 |  | Sainsbury's Red Pepper ] 
        [ 0000000005609 | Audio CD | The WNCI Morning Zoo - Now That's What I Call Junk! ] 
        [ 0000000006217 | 1 gal | Trader Joe's 1% Lowfat Milk ] 
        [ 0000000007511 | 44 oz | Maverik Plastic Soda Cup ] 
        [ 0000000043816 | 1.76 oz | Altoids/ Peppermint ] 
        [ 0000000005210 |  | maggi ] 
        [ 0000000001090 | VAR | Rountech Asset 1 ] 
        [ 0000000001151 | 50g | Marks & Spencer Curiously Strong Mints ] 
        [ 0000000001205 | 1 gal | GIANT NATURAL MOUNTAIN SPRING WATER ] 
        [ 0000000004138 | 100 pack | Taiyo-Yuden Value Line 8x DVD-R ] 
        [ 0000000004145 | 7.6 cm x 1.8m | Conforming Bandages ] 
        [ 0000000004411 | 14 oz | Mama Lisa's Molten Lava Cake Mix ] 
     }

SORTED:
A = { 
        [ 0000000001090 | VAR | Rountech Asset 1 ] 
        [ 0000000001151 | 50g | Marks & Spencer Curiously Strong Mints ] 
        [ 0000000001205 | 1 gal | GIANT NATURAL MOUNTAIN SPRING WATER ] 
        [ 0000000001243 |  | CVS Photo 1-Hour 4x6 Finishing ] 
        [ 0000000001601 |  | Sainsbury's Red Pepper ] 
        [ 0000000002288 | 18 oz | Winn Dixie Hand Lotion ] 
        [ 0000000002745 |  | sunglasses ] 
        [ 0000000003278 |  | ulta 3$ gift certificate  ] 
        [ 0000000004138 | 100 pack | Taiyo-Yuden Value Line 8x DVD-R ] 
        [ 0000000004145 | 7.6 cm x 1.8m | Conforming Bandages ] 
        [ 0000000004411 | 14 oz | Mama Lisa's Molten Lava Cake Mix ] 
        [ 0000000005210 |  | maggi ] 
        [ 0000000005609 | Audio CD | The WNCI Morning Zoo - Now That's What I Call Junk! ] 
        [ 0000000006217 | 1 gal | Trader Joe's 1% Lowfat Milk ] 
        [ 0000000007511 | 44 oz | Maverik Plastic Soda Cup ] 
        [ 0000000043816 | 1.76 oz | Altoids/ Peppermint ] 
        [ 0000000046268 |  | JICAMA ] 
        [ 0000000049887 | 1 x 8 oz | Coca Cola:Diet Coke ] 
        [ 0000000050340 |  | 12057 2X72X150 POULTRY NETTING ] 
        [ 0000000052214 | 12oz | Big Y Italian Bread ] 
     }

5896 lines read (5877 valid records) in 438 milliseconds
5877 records sorted in 19 milliseconds

Enter a UPC to look up (q to quit): 8822
8822 not found

Enter a UPC to look up (q to quit): 2288
[ 0000000002288 | 18 oz | Winn Dixie Hand Lotion ]

Enter a UPC to look up (q to quit): q

Goodbye!

Test release 0.7 (find, insert, delete) with a variety of relevant start conditions. Discuss your choice of testing data in the lab report, along with the results.

Release 0.8

Before moving on, make sure you have completed Release 0.7 and have saved it separately. Begin working with a new copy for Release 0.8.

Modify your UPCProductList class to use a binary search tree rather than an array as the underlying storage structure. Use the UPC number as the sort field. Since binary search trees are sorted, you can remove the body of the "sort" method.

Test release 0.8 (find, insert, delete) with a variety of relevant start conditions. In your lab report, include a discussion of your choice of testing data, the results, and a comparison this implementation to the original in release 0.70.

Release 1.0

Before moving on, make sure you have completed Release 0.80 and have saved it separately. Begin working with a new copy for Release 0.90.

Modify your UPCProductList class to use a Red-Black tree rather than a simple binary tree as the underlying storage structure. You may consult any other sources you desire, and even modify existing code as needed, provided that you properly credit the source. At a minimum, that means giving credit in at least these three places:

  1. in the file header and class header,
  2. in the method javadoc comments and/or in-code comments;
  3. in the lab report.

Test release 1.0 (find, insert, delete) with a variety of relevant start conditions. In your lab report, include a discussion of your choice of testing data, the results, and a comparison this implementation to those in releases 0.7 and 0.8.

Submission

Submit a single, zipped, virus-checked archive with the following:

Copyright © 1999-2010| Gene Rohrbaugh | Privacy Statement