Assignment #8 - Beige&Chartruese Pages.
Objectives:
The main objectives of this assignment are:
- Use your dictionaries for a useful purpose.
- Examine real-life applications of map/dictionaries
The Assignment:
The Concept:
B&C Corporation is developing applications for the bcPhone,
their new handheld multimedia device. Initially, they were
going to just steal "borrow" software from
[company name not disclosed], but costly allegations of patent
infringement and copyright violations have convinced them to
"hire" software developers (Who work for grades rather than $$$)..
after a few days in a losing court case, they decided to write their own software.
One of their pet projects is to include a Beige & Chartruese Pages (off-white & off-yellow).
Basically, it's a way to look up phone numbers, addresses, and search for groups of people.
The bcPhone connects to the dusty 10 year old laptop server in the basement control room, asking for lists of records.
As you might expect, the software must be efficient to serve the millions of
expected bcPhone users.
Your Job:
You have three tasks:
- Complete the BeigeChartrueseLibrary methods, including code to respond to queries, code to add records, and code to search.
- Complete the Record methods, so that records can be displayed appropriately.
- Complete and/or add methods to the PhoneNumber, StateAbbr, and ZipCode classes, so that they function within the dictionaries appropriately.
Getting Started:
- Download and import the following zip file: Assignment8.zip. For
Eclipse:
- Open Eclipse
- Choose "File → Import".
- Select the "General" category.
- Pick "Existing Projects into Workspace"
- Click on "Next"
- Select the button for "Select Archive File" and
browse to/select the zip file.
- Click on "Finish"
- After importing the project you should look at which dictionary implementation(s) you want to use from assignment 7.
Requirements:
You are given the BeigeChartrueseLibrary class, which containes
a main method, a constructor, and a number of other methods. You should
complete that class using any or all of the dictionaries developed
previously. Also given are classes representing the information:
Record, PhoneNumber, ZipCode, and
StateAbbr. These classes are provided so that you may create
appropriate hash functions, comparisons, and equality tests for the specific
types of values given in the program. Records are comparable, which means
they have a natural ordering. When returing sequences of Records, they
should be in that natural ordering. This may require taking various steps
to improve the efficiency of the overall program.
The bcPhone user can do a search by name (first, last or full), city, state, ZIP code, or phone number.
A person's full name is their first name followed by their last name separated by a space.
They can also do a combination search, where they enter more than one field, and a search is performed,
returning results that match all the provided criteria.
When the user searches, it sends a comma delimited text request to the laptop
server and expectes a comma/line delimited text response.
The text request comes in one of the following forms:
- BYNAME,name
- BYCITY,city
- BYSTATE,state
- BYZIP,zip
- BYPHONE,phone
- COMBO,name,city,state,zip,phone
- ADD,security,f_name,l_name,addr,city,st,zip,phone
The response should be in the form:
FirstName LastName
Address
City, ST
ZIP
Phone_number
NextPersonsFirstName LastName
123 Address
MyCity, VI
54321
234-555-6789
...
Responses should be in the natural ordering defined for Records
(provided in the Record class). Be sure there is a space
between the names, a comma and space after the city. Each record
should have a blank line after it, and the last record should have
two blank lines.
Some other information which your program should conform to or may be helpful:
- The state is always a two-letter abbreviation representing a US State, Territory, or the District of Columbia (DC).
- The ZIP code is always a 5 digit numeric value.
- The phone number is always a 10 digit value, broken by two dashes after the 3rd and 6th digits (DDD-DDD-DDDD).
- When searching by Name, if should return anyone with the string matching
a first name, last name, or full name. You also must reduce copies. If a
record is found more than once (i.e Carlton is searched, and there is record
for a "Carlton Carlton", so it matches both first and last name),
the duplicate should only be displayed once.
- In a COMBO search, any or all of the fields may be left blank,
indicating that field is not restricted in the search. So, the
[COMBO,William,,,49930,] would return all people with first or last name
William who have the zip code 49930. Also, as with the Name search, a
record should not be displayed multiple times.
- When adding an entry remotely, a specific security code must be
provided. That security code is 12345. If the security code is incorrect,
the record is not added.
- When the server is reset, it should take no longer than 5 minutes to
populate the Library (add all of the records).
- Responses to the bcPhone should be as fast as possible. If any response
takes longer than 30 milliseconds, the phone will assume the server will not
respond. However, you can be assured that there will never be more than
500,000 entries in Library.csv.
- Records with the same state are very common. First names are more
common than last names. City names are less common than first names, but
more common than last names. Zip codes are less common than last
names.
Submission:
First, look at the following checklist:
- Are all the necessary source files included? (Lists, sorts,
dictionaries, etc.)
- Does the program compile on CS machines?
(Programs that don't compile for us will not be graded)
- Do you ever import from java.util.
If so, be sure you only import allowed components (like Iterator,
Exceptions, etc.). Unless the assignment specifically mentions it is
permissible, you should never include any of Java's native data
structures.
- Does the program meet all required interfaces?
- Have you tested every method in some way?
- Do all your methods have a @TimeComplexity
indicator?
- If any methods have a good amortized or expected cost, do
they have both the @TimeComplexity and either @TimeComplexityAmortized
or @TimeComplexityExpected
- Do all your data structures (and other classes like
iterators) have a @SpaceComplexity indicator?
- Do you provide adequate TCJ and SCJ
comments to prove your time and space complexity?
- Is the indentation easily readable? You can have Eclipse
correct indentation by highlighting all code and select "Source
→ Correct Indentation".
- Have you removed any of the "cs2321" comments (/*#)?
- Are comments well organized and concise?
If you have reviewed your code and all the criteria on the checklist
are acceptable, follow the submission procedure.
Grading Criteria:
- A BeigeChartueseLibrary class which uses Dictionaries to correctly
implement the described functionality: 70
- Correct documentation of time and space complexity: 10
- Choosing and justifying the best Dictionary implementation(s)
for this problem: 10
- Clear concise code with good commenting: 10