CPSC-102: Computing and Algorithms II
Programming Assignment 4
In this programming assignment, you will demonstrate your knowledge of
dynamic data structures (in particular, binary search trees) by revising the
video database program from Programming
Assignment 3 to incorporate a new dynamic data structure.
New Internal Requirements
For this assignment, you should replace your Database class with
another implementation which uses binary search trees to organize the
lists of videos. As before, you should maintain the database as two
separate trees of videos: one for videos currently in stock, and one
for videos which have been checked out. The search order for the
binary search trees is the same as before: ascending order by title.
New Functional Requirements
Your program will be an extension of Programming
Assignment 3, and thus should operate in the same manner as that
assignment, unless otherwise specified herein. In particular, this
means that any errors present in your submissions for Programming Assignment 3 should be fixed for
The following new requirements should be implemented as well:
Submitting Your Program
Before 11:59:59 p.m., Thursday, 3 September 1998 (9th Thursday), you
must email a single file to firstname.lastname@example.org
containing all source code files for your program, including a file
named Prog4.java containing a main method.
In addition, you must deliver to the instructor a printout of your
program files at the start of class on Friday, 4 September 1998 (9th
In order to write to a file, the java.io.FileWriter and
java.io.BufferedWriter classes may be used in much the same
way that FileReader and BufferedReader are used.
There are two significant differences:
See the Java API for details.
- There is no equivalent method to readLine();
you should use a combination of write() (which can write
a string to the file) and newLine() (which writes an
end-of-line character to the file).
- Once you are finished writing to a file, use the
close() method to flush the output buffer to the disk.
(Otherwise, data may be lost.)
last updated: 20 August 1998