% java MallSearch
Please enter match type ('exact' or 'wild') or 'exit': exact
Please input the store type: department
Please input the store name: Hudson's Bay Company
Please input an item type: bedding
"Hudson's Bay Company": department store selling bedding, located on floor 1, #1.
1 match printed.
Please enter match type ('exact' or 'wild') or 'exit':
Please input the store type:
Please input the store name:
Please input an item type: CD
"Sam's": entertainment store selling CDs, located on floor 1, #11.
"HMV": entertainment store selling CDs, located on floor 3, #1.
2 matches printed.
Please enter match type ('exact' or 'wild') or 'exit': exit
%
The MallMap class builds an index of all the stores in the mall, using instances of Store. It is documented here, and the class file for it can be downloaded here.
The Store class represents a single store, recording the store name, type, and the types of things it sells. It is documented here, and the class file for it can be downloaded here.
The MallSearch class is the application class. Its main method reads in the criteria described above and invokes the method printSearchResults to perform the actual search. It is this method which you must now complete. Unfortunately, the arguments have not been specified for the method, so you will also have to decide which arguments you think you need to pass in to the method, both formal and actual. In addition to these two methods, three service methods have been defined: getLineWithPrompt, getMatchType, and getStoreType, as well as three useful constants: MATCH_EXACT, MATCH_WILDCARD, and EXIT. You can use any or all of these, or none, as seems appropriate. You can also define your own constants or service methods, if you think it appropriate. (Remember that reuse is generally a good thing, and your use of existing code will be considered when marking the assignment.) It is documented here, and the Java source for it can be downloaded here.
When you compile and run your code, you must make sure the class files downloaded from this site are in the same directory as your MallSearch code!
"name": type store selling item, located on floor floor, #store number.
% java MallSearch
Please enter match type ('exact' or 'wild') or 'exit': exact
Please input the store type: book
Please input the store name:
Please input an item type:
Sorry, no matches found.
Please enter match type ('exact' or 'wild') or 'exit': wild
Please input the store type: book
Please input the store name:
Please input an item type:
"The Bookworm": book store selling books, located on floor 1, #5.
"Kohl's": book store selling books, located on floor 3, #2.
2 matches printed.
Please enter match type ('exact' or 'wild') or 'exit': wobble
Unknown match type. Using wildcard.
Please input the store type:
Please input the store name: orium
Please input an item type:
"The Emporium": gift store selling ceramics, located on floor 1, #3.
"The Wombatorium": specialty store selling stuffed wombats, located on floor 3, #3.
2 matches printed.
Please enter match type ('exact' or 'wild') or 'exit':
Please input the store type:
Please input the store name:
Please input an item type: art
"The Hollow Tree": gift store selling art, located on floor 2, #8.
1 match printed.
Please enter match type ('exact' or 'wild') or 'exit': WILD
Please input the store type: department
Please input the store name: HUDSON
Please input an item type: cloth
"Hudson's Bay Company": department store selling clothing, located on floor 1, #1.
1 match printed.
Please enter match type ('exact' or 'wild') or 'exit': wild
Please input the store type: entertainment
Please input the store name:
Please input an item type:
"Sam's": entertainment store selling CDs, located on floor 1, #11.
"HMV": entertainment store selling CDs, located on floor 3, #1.
"Ars Electronica": entertainment store selling guitars, located on floor 3, #7.
3 matches printed.
Please enter match type ('exact' or 'wild') or 'exit': wild
Please input the store type:
Please input the store name:
Please input an item type:
"Hudson's Bay Company": department store selling bedding, located on floor 1, #1.
"Meerschaum Mania": specialty store selling pipes, located on floor 1, #2.
"The Emporium": gift store selling ceramics, located on floor 1, #3.
"The Bookworm": book store selling books, located on floor 1, #5.
"Glad rags": clothing store selling dresses, located on floor 1, #6.
"Ruggles": home store selling carpets, located on floor 1, #7.
"East 52nd": clothing store selling pants, located on floor 1, #9.
"The Bermuda Triangle": clothing store selling sunglasses, located on floor 1, #10.
"Sam's": entertainment store selling CDs, located on floor 1, #11.
"Pickle Heaven": food store selling food, located on floor 2, #1.
"Squishy's Squids": food store selling frozen squid, located on floor 2, #2.
"C-C-C-Cupcakes": food store selling cupcakes, located on floor 2, #4.
"The Skinned Weasel": food store selling pub, located on floor 2, #5.
"Dirt City": specialty store selling vacuum cleaners, located on floor 2, #7.
"The Hollow Tree": gift store selling sculptures, located on floor 2, #8.
"Sears": department store selling bedding, located on floor 2, #9.
"HMV": entertainment store selling CDs, located on floor 3, #1.
"Kohl's": book store selling books, located on floor 3, #2.
"The Wombatorium": specialty store selling stuffed wombats, located on floor 3, #3.
"Le Clochard": clothing store selling suits, located on floor 3, #4.
"Millicent's Millinery": clothing store selling hats, located on floor 3, #5.
"Homer's": home store selling pots, located on floor 3, #6.
"Ars Electronica": entertainment store selling guitars, located on floor 3, #7.
23 matches printed.
Please enter match type ('exact' or 'wild') or 'exit': exit
%
You can test your application automatically by redirecting this
file
of input lines (derived from the above) and comparing your program's
output against this output file.
Note: if you run the supplied program without modification, you will get
this output instead.