CS 596 Client-Server Programming
[To Assignment Index]
San Diego State University -- This page last updated February 6, 1996
Assignment 1 - Some Java Programs - Due 2/15/95
1) Write, compile and run a Java program the prints "hello world" on the
2) Design, implement and test a two dimensional Matrix class. The requirements
for the class are listed below. You might find the class java.util.Vector of
implement and test a two dimensional labeled Matrix class. The requirements for
the class are listed below. You might find the classes Hashtable and Exception
- Have a constructor which has the size of the Matrix as argument(s).
- Be able to access an element at a given row and column. For example return
the item in the 3'rd row and 5'th column.
- Be able to change the value at a given row and column. For example set the
item in the 3'rd row and 5'th column to the string "HI".
- Throw an ArrayIndexOutOfBoundsException when an nonexistent location in
the matrix is accessed.
- The matrix should hold items of type Object.
- Be able to return a given row or column as a vector. For example return
the 4'th column, or return the 2'nd row.
- Implement a toString() method. Items on the same row should be separated
by a tab. Rows should be separated by a line feed.
- No IO should be done from a method in this class. (Why?)
4) Create a cs596 package. Add your two the classes from 2 and
3 in the package.
- Make this class a subclass of Matrix
- Each row and column has a string label. For example a row might be
labeled "Joe Chen" and a column might be labeled "Exam One".
- Be able to a access an element at a given row and column indexed by
strings. For example, return the element at row "Joe Chen" and column "Exam
- Be able to change the value at a given row and column indexed by strings.
- Throw an NoSuchLabelException when an nonexistent location in the matrix
5) Write a method to translate a string to a Matrix object. Assume that the
string is created from the toString() method in your Matrix class. Also assume
that all the items in the string represent integers. You might find the classes
StringTokenizer and Integer of interest.
What to turn in!
- Turn in the source code for the classes created in 2) and 3) as part of
the package cs596.
- Turn in a program(s) testing these two classes. The program should use
the classes as part of the package cs596. Include output.
- The program for 5). Include output.
- Don't forget, you need to turn in three copies.