15-111 Intermediate/Advanced Programming
Assignment 2 - RANDOM MATRIX CLASS
15-111 Sections G and H
Start:          Wed 09-05-01
Due:  11:59 PM  Wed 09-12-01
Goal:  review arrays, introduce classes, introduce the API

Course Web Site:   www.andrew.cmu.edu/~guna/15-111

Assignment:
Write a program that uses a class that builds and works with a matrix (two dimensional array) of int values.

Specifications:
- This will use only two classes - Driver and RandomMatrix.   Do not add additional classes
- The Driver class is given to you in a complete form.  You may modify this class for testing but the handin version of the class
   Driver must be exactly as given to you.
- The RandomMatrix class is fully "stubbed out" meaning that the needed fields (data members) are declared and all of the required
   methods are coded with printlns that must be replaced with the appropriate Java code.
- The constructor method, RandomMatrix has three arguments:  newRow, newCol, and maxValue.  This method must assign the values of new Row and new Col to myRow and myCol respectively.  It must construct a matrix of this size and assign a random number between 1 and maxValue to each element of the matrix.  You will use the Random class's nextInt( ) method to generate the random number.  The Java API is your source of information about this class.  A link to the API is on the course web page.
- Each of the remaining methods must implement the task as indicated by the name of the method and explained in the comment of the method.
 

Practical Concerns
The template is available from the course web site.  If you have Codewarrior installed, download the CW version of the zip file and extract it. Do not change the names of the files or the classes - Java and Codewarrior will punish you!
Write this in pieces.  Start with the constructor and put in debugging  statements and/or use the debugger.  Once you have
the constructor finished and the code compiling, work on the printMatrix( ) method.  Do not go on to other methods until printMatrix is working.  Continue in a stepwise manner.  Start tonight and get help as you need it.  Do not wait until next Monday night to start this lab.

Handin
You have to hand in all files - delete nothing.
Use the handin mechanism as demonstrated in class.
Click Here to handin your assignment

Some Last Thoughts
As with lab one, starting sooner is better than later.  Java and Codewarrior should not be as big an obstacle but some of you will still encounter problems.  Starting early provides much time to get help.  Starting late is just stupid - don't do it.  Once again, this is not worth a night' sleep.  Work on this as long as progress is being made.  If you can't get something to work in 15 minutes, quit and do something useful.  Get help later.