COSC 286: Computer Graphics

Project 1
Spring 2007

Due: Jan 19 @ 5 P.M.
5 points

  1. Implement DoubleMatrix, a class for storing and manipulating m-by-n matrices of double. In addition to constructor methods, provide methods for matrix mutliplication and for creating the identity matrix.

    The method for matrix multiplication should implement C = AB, where the matrix A is an instance of DoubleMatrix and is passed in as a parameter.

    When you run your program it should print the results of the two following matrix multiplications. In both cases, the A matrix is the first one.

                    [[ 4 ]
    [[2  4  -2  3]   [ 1 ]
     [-1 0   2  3]]  [-1 ]
                     [ 3 ]]
    
    [[2  3  -1] [[1]
     [1  0   1]  [2]
     [4 -3   1]  [3]]
    
    You can use arrays to implement DoubleMatrix, which will probably be more convenient and more efficient for what lies ahead. If you want to use something from JCF, go ahead, but you must then use generics. (See below.) Note that there are some difficulties with creating generic arrays.

  2. Implement SortedLinkedList, a sorted sequence. Do so by using generics and by extending Java's LinkedList, which is part of the Java Collections Framework. (LinkedList is actually a sequence because it provide both sequential and random access to elements.) Demonstrate SortedLinkedList by inserting, say, String objects and printing them to the console.

Instructions for Submission:

All classes and class members must be documented with Doc comments.

In the header comments, provide the following information:

/**
 * @author <Name> (<E-mail Address>)
 *
 * In accordance with the class policies and Georgetown's Honor Code,
 * I certify that, with the exceptions of the class resources and those
 * items noted below, I have neither given nor received any assistance
 * on this project.
 */
When you are ready to submit your program for grading, create a compressed archive of a directory containing only your project's source, and use the submit program to (you guessed it) submit your project.

The directory's name should be the same as your net ID. For example, assume your net ID is ab123. Assume you're in the directory above the one containing your source code. If the directory p1 contains your project, then rename the directory to ab123.

If you need to include a message, put it in a file named README.

To make the archive smaller, remove any .class files:

% rm ab123/*.class

Use jar to create an archive:

% jar cf ab123.jar ab123

You can also use jar to create an archive containing only the .java files:

% jar cf ab123.jar ab123/*.java

To use the submit command to submit your project, type

% java -jar submit.jar -a <assignment> -f <file>
where <assignment> is the assignment name and <file> is the name of your java-archive file. For instance, continuing the example, to submit, you would type
% java -jar submit.jar -a p1 -f abc123.jar
submit.jar should reside in the directory above your project directory. The first time you run submit, you'll have to provide your name and net ID.

Ideally, you should keep a copy on a university or department machine, such as seva. Make sure that your archive, directory, or files are not readable by others.

Submit your project before 5:00 P.M. on the due date.