Cmpt 225
Simon Fraser University
School of Computing Science
Cmpt 225 - Assignment #2
Library Management Application - Version #2
Due: Friday, February 16 @ 23:59:59
Before We Start
The following is a list of topics we recommend you have a good understanding
of in order to successfully complete this assignment:
-
The Phases of the Software Development Process (see Course Material on
our course web site)
-
Abstract data type (ADT) class
-
Linked list and object references (or pointers)
-
Java interfaces and "implements" keyword (for the Java software developers),
template (for the C++ software developers)
-
Exception handling
-
I/O: Input from the keyboard and output to the console (monitor) - see
Chapter 1 of your textbook
-
I/O: Input from a file (input file) and output to a file (output file)
But first, read this assignment in its entirety before diving into it!
You are free to select either Java or C++ when implementing your solution
to this assignment.
Have fun!
Objectives
In this assignment, you will gain experience
-
performing the phases of the software development process while developing
an object-oriented program,
-
creating reference-based (pointer-based) abstract data type (ADT) class
( List ADT ),
-
for the Java software developers: your List ADT class must implement the
Java interface class provided in this assignment,
-
for the C++ software developers: your List ADT class must satisfy constraints
described in this assignment,
-
constructing a non-trivial data collection based on references (Java) or
pointers (C++),
-
manipulating nodes in a non trivial linked-list using references or pointers,
-
throwing and catching exceptions (using exception handling),
-
using files to perform input and output.
Problem Statement
In this assignment, you are to enhance the simplified version of the Library
Management Application you created in Assignment #1. We will call this
enhanced version of the Library Management Application version 2.
Your Library Management Application version 2 must allow the user to
perform the following actions:
-
create a library resource,
-
delete an library resource,
-
modify any of the information related to this library resource (except
the last name of the author, and the title of the resource),
-
display all the library resources (for each library resource, display only
the title of the resource, the author's full name and its library call
number) in alphabetical sorting order of author's last name,
-
display all the library resources (for each library resource, display only
the title of the resource, the author's full name and its library call
number) in alphabetical sorting order of title,
-
select a library resource (by specifying the author's last name or its
title), and display all the information for this library resource.
***A word about Title: to keep this problem simple, consider the
whole title when sorting your library resources. In other words, include
articles such as "The", "A", etc..., as part of your title. For example,
here is a short list of titles alphabetically sorted:
-
A Little Lamb
-
Alice in Wonderland
-
The Fall of the Roman Empire
-
Theology: A Modern Perspective
***A word about Duplicated Last Name and Title: to keep this problem
simple, duplicated last names and titles are ***not*** allowed.
An library resource, in our Library Management Application version
2, represents a book and it holds the following information about this
book:
-
title
-
author's last name
-
author's first name
-
library call number
-
publisher
-
edition number
-
date of edition
-
number of pages
-
ISBN
Specific Requirements
In creating your Library Management Application version 2, you must satisfy
the following requirements:
-
You must have a class called Resource (Resource.java
OR Resource.h and Resource.cpp) as part of your Library Management
Application version 2. This class represents a library resource.
-
When creating your reference-based (pointer-based) abstract data type (ADT)
class ( List ADT ), you must name it SortedList (SortedList.java
OR SortedList.h and SortedList.cpp). Also, the Java software developers
amongst you must make use of this Java
interface when designing and implementing the SortedList.java.
This is to say that your List ADT class must be declared as follows:
public class SortedList implements SortedListInterface
{
...
The C++ software developers amongst you must design and implement the methods
of the SortedList class such that these methods satisfy the
constraints found in this file.
-
On start-up, your application must populate the data collection using the
information stored in an input file, if the input file does exist and it
is not empty). The input file must be specified by the user, i.e., your
application asks the user to enter the filename. At shutdown, your application
must store the content of the data collection in this same file. Do not
forget to ask the user whether or not s/he wants to save the data before
your application does save the data into this file. Note: The manner
in which you save the data inside the data file (i.e., its format) is entirely
up to you. However, in this assignment, you cannot use Java object serialization.
-
When constructing your reference-based (pointer-based) data collection,
keep the following requirements in mind:
-
A resource object cannot be duplicated in your data collection.
-
Your data collection must never be full (unless we run out of memory).
-
Construct your data collection such that the operations that display all
the resources are performed in O(n).
-
For Java software developers: You must name your Library Management Application
class (the class with the main method) LMA2.java. The reason
for this is that it will be easier for the marker to execute your application.
S/he will simply need to type this command in order to execute your Library
Management Application version 2:
java LMA2
General Requirements *** very important ***
As in Assignment #1, please, read the General
Requirements and Marking Scheme for Assignments. This document lists
some general requirements your solution to this assignment must satisfy.
Getting Started
As in Assignment #1, the first thing you will need to do is ensure that
the problem statement and the requirements stated in this assignment are
clear to you. Feel free to drop by the instructor's office hours with your
questions. Once the problem statement and the requirements stated in this
assignment are clear, you can proceed to Phase 1 - Design, etc.
Submission
Assignment #2 is due Friday, February 16 @ 23:59:59.
You must electronically deliver this assignment via the Submission program.
More specifically, you must submit:
-
Your completed UML design diagram from Phase 1 in a ".html"
document called DesignDiagram.html (or an acrobat
document called DesignDiagram.pdf). This diagram must contain
completed "boxes" with class name, class attributes as well as class operations
with UML syntax as seen in class. You must also represent all the relationships
you have found between your objects (classes) using UML notation, also
as seen in class.
-
All your source files (Java or C++ code) properly named. Only submit your
*.java files (for Java) OR h.* and *.cpp files as well as your C++ makefile
or .dsw files (for Visual C++). Do not submit your *.class files (for Java)
OR your executable file (for C++). Do not create Java packages nor Jar
files, instead, put all your source files in one directory, namely the
src directory (see below).
When zipping your Assignment #2 directory, make sure you have the following
directory structure:
-
your top directory must be called assn2
-
it must contain a completed copy of the file cover_page.html
or cover_page.txt
-
it must also contain the following three subdirectories:
-
src -> which must contain all your code. Also include the
Java interface file (SortedListInterface.java) if you used Java
to develop your LMA version 2 as well as your C++ makefile or .dsw files
(for Visual C++).
-
doc -> which must contain your DesignDiagram.html
(.pdf)
-
data -> an example of your input/output file, i.e., a file
in which your application has already saved your data collection (some
resources) and which can be used to repopulate your data collection if
the user enter that specific filename.
Note that in this assignment you do not have to submit your algorithms,
test plans and test drivers. You are, however, strongly advised to practice
creating such documents. You can present them to your TA's and instructor
for feedback.
Anne Lavergne - Last revision date: September
2006