Java代写 | COMP1406A Assignment 5: Lists and Maps

本次作业是练习使用Java中的Lists和Maps集合

COMP1406A Assignment 5: Lists and Maps
In this assignment we get practice using ArrayLists and HashMaps and how to query them. There are two classes. The
ResearchPaper class is the record, and PaperDBModel is the database. You are to finish PaperDBModel by properly storing
and retrieving the records in ArrayLists and HashMaps.
You are given some test records in a file paper.txt. Most IDE’s are particular about where they read files from. If you are
using IntelliJ, you must copy it and paste paper.txt into the project folder (that is, the highest level folder that contains your
src, out, and .idea folders).
You are encouraged to add records to paper.txt for testing purposes (see question 5).
When you submit, all source code files must be in a package named assign5, and submitted in a zip file assign5.zip. That is,
zip up the package containing your source code, your README.txt (described below), and paper.txt and submit that.
Failure to submit in the code in the proper package or using some other file structure is -5 marks.
1) [4 marks] Open PaperDBModel.java. All the data structures you need are listed as member variables. Instantiate each of
them in the constructor.
2) [8 marks] Complete getResearchPaper, getPapersByAuthor, getPapersByConference, and getPapersByKeyword.
Descriptions are in the comments. Note the return type.
3) [20 marks] Complete AddResearchPaper and RemoveResearchPaper (most of the work is here). Each paper should be
added or removed from all data structures.
4) [12 marks] Complete a) getPapersByAuthorAndConference and b) getPapersByAuthors. These methods should return all
papers that a) were published in the given conference and have the given author listed, and b) have all the given authors
listed.
5) [8 marks] The static main method loads some records from a file (paper.txt) and prints them to the console. Write tests for
the methods above. Simply printing them out is enough, but there must be records that both meet the description of the
method and those that do not so that we can determine the method works properly. For example, in getPapersByAuthor
you must have at least one record with the author given as argument, as well as at least one record without. You can add
records to paper.txt by following the instructions in paper.txt
6) [8 marks] Document what works and what doesn’t by including the output of your tests along with a short explanation
of why the tests are correct. Put this in a file README.txt. If a method does not work, there is no need to include the
output, but you still must document that it does not work.