I change the due date to Wednesday, 30 October, at 2:30 p.m. It is my intention to apply a 5% per day late penalty beyond that point.
The original due date was Wednesday, 23 October 1996, 2:30 p.m.
To give you practice in the implementation of ADTs (classes) in Java given relatively detailed interface specifications.
This assignment develops ADTs for manipulating "records" about the Departmental technical reports. Each record includes the following information:
A valid report identifier is 6 characters in length. It begins with a non-space character. All alphabetic characters are in lowercase.
This is the key field for the record. That is, it should uniquely identify the record within a collection of all reports of interest.
Design and implement a Java class ReportId
for storing
and manipulating the report identifiers as described above.
ReportId
class must preserve the
following invariant:
Include methods with the following signatures and semantics in the class.
public ReportId(String id)
id
is a valid report identifier string, except that
it may contain extra leading or trailing spaces and consist of a
mixture of upper- and lowercase characters.
ReportId
is initialized to hold
id
, with leading and unnecessary trailing spaces removed
and all alphabetic characters replaced by their lowercase equivalents.
public int compareTo(ReportId r)
r
. The value returned is 0 if they are equal,
-1 if this instance is less than r
, or 1 if this instance
is greater than r
.
public String toString()
String
.
You should design, implement, and test this class by itself before integrating it with remainder of the program.
Design and implement a Java class Report
for storing
and manipulating the technical report "records" as described above.
Report
class must preserve the
following invariant:
Include methods with the following signatures and semantics in the class.
public Report(ReportId id)
id
is a valid report identifier.
id
. All other fields have reasonable default values.
public void setAuthor(String newAuthor)
newAuthor
.
public void setTitle(String newTitle)
newTitle
.
public void setPubDate(String newPubDate)
newPubDate
.
public ReportId getKey()
public String getAuthor()
public String getTitle()
public String getPubDate()
public String toString()
You should design, implement, and test this class and integrate it
with the ReportId
implementation before integrating it
with the remainder of the program.
Design and implement a Java class ReportTable
for storing
and manipulating a collection of technical report "records".
ReportTable
class must preserve
the following invariant:
ReportTable
contains a valid collection of valid report
records.
(No key occurs more than once in a valid collection. The internal
representation is otherwise consistent.)
Include methods with the following signatures and semantics in the class.
public ReportTable(int size)
size >= 0
size
technical report "records"; it is empty initially.
public void insert(Report r)
r
is a valid report record.
This instance's collection is not full.
A record with key getKey(r)
does not occur in the
collection.
r
inserted into the collection.
public void delete(ReportId id)
id
is a valid report identifier.
This instance's collection is not empty. A record with key
id
occurs in the collection.
id
is removed from the
collection.
public void print(PrintStream os)
os
is an open print stream.
os
. (The records may be printed in any
order that is convenient with the internal representation.)
public Report retrieve(ReportId id)
id
is a valid report identifier.
This instance is not empty. A report record with key id
occurs in the collection.
id
from the
collection. (The collection is not modified.)
public boolean isIn(ReportId id)
id
is a valid report identifier.
id
occurs
in this instance's collection.
public boolean empty()
public boolean full()
public void destroy()
You should design, implement, and test this class and integrate it
with the Report
and ReportId
implementations
before integrating it with the remainder of the program.
Design and implement a Java driver program that:
ReportTable
instance,
PrintStream
file to "log" the activity of
the program,
ReportTable
instance (writing appropriate messages to the log file),
The input file report.txt
will be available from the URL
ftp://ftp.cs.olemiss.edu/pub/csci211/assignments/report.txt
.
This is a text file containing information about a set of Departmental
technical reports (many real, some imaginary).
You may assume that there are no more than 100 reports described in
the input file.
The data on each report are recorded as a group of five consecutive lines. All "fields" described below begin in the first character position on the line (i.e., they are left-justified).
$$
" beginning a line
Once you have completed the program:
cs211@hal.cs.olemiss.edu
.
If your program consists of more than one file, please concatenate
them together with comments labelling the parts.
UP to CSci 211 Assignments page?