Papers

The program simulates the management of journals and papers (i.e. articles). All classes are found in the papers package. The main class is Papers. The TestApp class in the example package contains examples and presents the main test cases. Exceptions are thrown using the JException class; only the specified checks must be carried out and not all possible ones. If a method throws an exception there is no change in the data present in the main class. Suggestion: every time you have implemented a method, run TestApp to check the result.

The JDK documentation is accessible at URL https://oop.polito.it/api/.

R1: Journals

Method int addJournal (String jName, String type, int expectedValue) inserts a new journal with name (jName), type (kind of activity of the journal), expectedValue (of the journal). It throws an exception if the name already exists. The result is the number of characters of the name.

Method getJournalNamesInAlphabeticalOrder() returns the List of the journal names in alphabetical order.

R2: Authors and papers

Method registerAuthors (String... authors) registers the authors (an author is represented by his/her name). A duplicate name is ignored. It returns the List of author names in alphabetical order.

Method String addPaper (String jName, String type, String paperTitle, String... authorNames) adds to the journal (indicated by its name (jName) and the type of the journal) the title of the paper and the names of the authors. It throws an exception in four cases:

  1. the journal cannot be found as its name does not exist;
  2. the type of the journal is different from the type indicated in the method;
  3. the title of a paper is repeated (the title of a paper must be unique);
  4. one or more of the authorNames indicated in the method have not been registered.
The result is the journal name followed by ":" and the paper title.

R3: Papers

Method getPapers (String author) returns the List of the titles (in alphabetical order) of the papers related to the author. It throws an exception if the author has not been registered.

Method getNumberOfPapersByAuthor() returns the SortedMap whose keys are the author names in alphabetical order and the values are the numbers of papers for each author. An author without papers is not considered.

R4: Statistics

Method groupJournalsByType() returns the SortedMap whose keys are the types of journals and the values are lists of names of journals having the same type.

Method groupJournalsByExpectedValue() returns the SortedMap whose keys are the expected values of journals and the values are lists of names of journals having the same expected values.

Method getNumberOfPapersByJournal() returns the SortedMap whose keys are the names of journals having at least one paper and the values are the number of papers for each journal.