ICS 22
Homework 9
Due 11/30
- Reminder: we check for cheating (via copying) and all students involved with get a grade of zero for this homework.
- Problem statement: write a program that allows the user to create and maintain a shopping Mall (a collection of Stores). Each Store has a list of Products it carries. Each Product has a name and a price. The program will allow the user to find the best prices on various products. Your program must have a load and save button to allow loading and storing (in the same format) a mall description from a specified file. See sample file SouthCoastPlaza in start directory.
- Design Sketch:
- class Product describes the object to hold the name (of type String) and the price in cents (of type int) of individual store products. It will have these two public data members and a constructor to initialize them to values supplied as parameters.
- class Store describes a single store. Each store will have a name (a public member variable of type String) and a product line implemented as a Sorted Linked List of Products. Sort them in ascending alphabetical order by product name.
- class Mall holds and maintains the entire collection of Stores. It is implemented as a Binary Search Tree of Stores indexed by store name.
- Give the complexity (in Big-Oh notation) for each method in class Mall and class Store. Write it in a comment next to or before the method definition.
- The GUI.
- You get to design this one. Make it nice.
- Include at least the following operations:
- load Mall from named file
- save Mall to named file. Be sure to use a preorder traversal to write the Stores to the file. What happens if you use an inorder traversal then re-load?
- insert named Store with Products (read the Store information from a TextArea, but you may read in the same format as is used in the input file)
- remove a named Store from this Mall
- lookup a named product and display all the stores who carry that product along with the price of that product at each store. Print them in order from lowest price to highest price.
- add a Product to a named Store with a given price
- lookup (and display) all the Products in a specified Store