COM6471 Assignment 3: A Library, but not the
Software Kind...
Dr Ramsay G Taylor
November 18, 2018
Introduction
This assignment requires you to build a Java program to manage the contents
of a library. Not a software library, but a library of people’s writings. Some
of these are Books, which are written by one person and have lots of chapters,
other things in the library are Journals, which have articles by different people,
and Newspapers which have stories by different people.
This assignment is broken down into five tasks. You should attempt all of
the tasks, but if you find one difficult you should still attempt the others and
submit whatever you produce.
1 Books, Journals, and Newspapers
You should create an abstract class called LibraryItem, and then create three
subclasses: Book, Journal, and Newspaper.
Books should have an author (recorded as a String with their name). Books
should have multiple chapters, each with a chapter number, chapter title and
some content text. Your Book objects should have an accessor method to get a
chapter by its number as a String, and to get the entire book as a single String.
It might be nice if the entire Book string has the title, author, and chapter titles
in it and some sensible line breaks!
Journals have an overall journal title, a year of publication, and a volume
number. Journals should have multiple articles, each of which should have an
author, a title, and some content text. It should be possible to access an article
by title, or get the entire journal as a single String.
Newspapers have a title and date of publication (to the day). Newspapers
have stories, which each have a headline, an author and some content. These
should be accessible by headline, or you should be able to get the whole Newspaper.
You may find that it is helpful to define other classes to make this neater or
more efficient. You can also use Java standard library classes like ArrayList or
LinkedList if they are helpful.
1
2 Libraries
Now that you have defined individual items you can define an entire Library
class. This should be a class whose instances contain many of the LibraryItem
objects that we defined in Task 1. Whether you use arrays, or some other type
of collection is up to you, so long as the behaviours described below and in the
subsequent tasks are implemented in a logical way.
This class will have several methods defined in the subsequent tasks, but at
this point it should at least have a toString() method which puts together all
the titles and authors of Books, all the titles and dates of Newspapers, and all
the titles, years, and volume numbers of Journals in the Library into one String.
You are welcome to add methods to the various classes from Task 1 if that will
help you.
3 Searching
Objects from Library class defined in Task 2 should have methods to search
the library. The following three methods are required:
getByTitle(String t): a method that returns one LibraryItem with
that title.
searchByAuthor(String a): a method which will return several LibraryItem
references if there are multiple works by this author.
searchByContent(String s): which returns multiple LibraryItem references
based on looking for the string s within the entire content of the
item.
4 Sorting
You should now add sort functions to the Library class from Task 2. There
should be sortByTitle() and sortByAuthor(). These should return a collection
of LibraryItem references, ordered alphabetically by title or author,
respectively.
At this point (if you haven’t already) you should also add a main method
somewhere to run a demonstration of your system. This should create a library
with a set of representative items and then demonstrate searching and sorting
it and print out some results to show that things are working.
5 Report
You should submit a report in clear, technical English that describes your Java
code, how the components operate, and how they interact. It must include at
least these sections:
2
A title page containing the title, your name and registration number,
and the following statement: I declare that this work is my own and I
acknowledge the contribution of others where appropriate.
Overview that describes the LibraryItem classes, and the Book, Journal,
and Newspaper classes (and any others that are important), and how they
fit together to form a coherent system. UML diagrams are allowed but
not required, other informal diagrams are also acceptable, but you should
include sufficient English prose description as well.
Four sections: LibraryItems, Libraries, Searching, and Sorting.
These sections document each of the sets of classes and methods in more
detail. They should be technical descriptions of the individual classes and
the operations of the significant methods using suitable OO language.
A Conclusion a summarisation of the submitted system and a brief (constructive!)
description of your understanding of Java and OO design.
There is no strict word limit for this assignment but as a rough guide: less
than 1000 words is unlikely to be sufficiently detailed, while much more than
2000 is probably excessive.
Submission and Marking
As with the previous assignments, you should submit your .java files through
MOLE. You should also submit your written report through MOLE in PDF
format. The individual components will be marked as follows:
Library Items [25%]
20 — 25 A set of classes with the correct inheritance structure and
methods at optimal points in the structure, making use of
polymorphism
15 — 20 A set of classes with the correct inheritance structure and
methods at reasonable points within that structure
10 — 15 A set of classes with the correct inheritance structure and
methods
5 — 10 A set of compilable class files with the required methods
0 — 5 A set of compilable class files
Libraries [15%]
10 — 15 An elegantly implemented set of properties and methods to
achieve the objective.
5 — 10 An adequate set of properties and methods to achieve the
objective.
0 — 5 Credit given for whatever appears.
3
Searching [15%]
10 — 15 An efficient and effective use of classes, subclasses, and
method calls between them to achieve the objective.
5 — 10 An adequate use of classes and subclasses to achieve the
objective.
0 — 5 Credit given for whatever appears.
Sorting [20%]
15 — 20 Effective class definition and methods, and a convincing
demonstration in the main method.
10 — 15 Functional class definition and methods and a demonstration
in the main method.
5 — 10 A class definition and set of methods that achieve some of
the objective, and that is partially demonstrated.
0 — 5 Credit given for whatever appears.
Report [25%]
20 — 25 A clear description of the overall system, separated into logical
sections to form OO elements, which are then described
in accurate, technical detail.
15 — 20 Each submitted code section described in an accurate technical
fashion, and the interactions between components discussed
10 — 15 Each submitted code section described in an accurate, technical
fashion
5 — 10 Each submitted code section at least described
0 — 5 Credit given for whatever appears
You are reminded that the University of Sheffield takes the use
of unfair means very seriously. The code you present for this assignment
must be entirely your own work. Code that is plagiarised — that is, copied
from somewhere else — is not acceptable and you will receive zero for this
assignment and be called to a departmental unfair means panel where it will be
investigated further. If you are found to have knowingly allowed your work
to be plagiarised you will also receive zero and be further investigated.
Since the purpose of these assignments is to test your knowledge of Object
Oriented design and Java, you must also avoid collusion — that is, discussing
your design or implementation with your classmates to such a degree that you
end up submitting similar work. Even if you have produced the code independently,
part of the object of the assignment is to evaluate your Object Oriented
design approach, so you must develop your solution independently.
版权所有:编程辅导网 2021 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。