This website is preserved for historical and scholarly reference and is no longer actively maintained.
CpSc 210, Section 1
Assignment 3
4 October 2001
Due: Thursday, October 11 by 11:59 p.m. Not accepted late.
Total point value of assignment: 100 points
This assignment is to be done INDIVIDUALLY.
Create a file named MyMatrix.java which will contain this assignment.
There will be a 20 point penalty for failure to name file correctly.
Assignment:
Problem 3.10 (page 48). Finish the two-dimensional Vector-like
structure Matrix. Each element of the Matrix is indexed by two
integers that identify the row and column containing the value.
Your class should support a constructor; methods addRow and
addColumn that append a row or column; the elementAt and
setElementAt methods; and width and height methods. In
addition, you should be able to removeRowAt and removeColAt.
(Note: the method name is removeColAt, not removeColumnAt.)
Two additional methods are needed:
public boolean equals ( Object other )
// post: returns true if this contains identical information
// to other; otherwise, returns false.
public String toString()
// post: returns a String representation of the Matrix.
// representation may contain newline characters (\n).
You must use Bailey's Vector class, so use
import structure.Vector;
Input:
Input should be contained in your test program (main).
Use the ReadStream class (page 334) that is part of Bailey's
structure package for both input and output.
Output:
Print your name, the assignment number, and a short description
of the assignment. Use the System.out commands.
Output should be contained in your test program (main).
Your class will also be tested with other test program(s).
Other requirements:
Follow the style standards to be found on your instructor's
web page for CPSC 210.
Submit your program using the handin command. There is a link to
the handin description on your lab page (www.cs.clemson.edu/~lab210).
Grading rubric:
Required documentation 10 pts.
Style standards 10 pts.
The program compiles without error. 10 pts.
If the program does not compile, no further points will be awarded.
Correct Methods:
width 5 pts.
height 5 pts.
equals 10 pts.
toString 10 pts.
insertColAt 10 pts.
addRow 5 pts.
addColumn 5 pts.
removeRowAt 10 pts.
removeColAt 10 pts.
When a method fails, no further testing will be done. Thus, if your
width method does not work, you will receive a maximum of 30 points.