Lab 1

Software Design Principles

January 20, 2005

Lab Partners

Everyone should work with one lab partner on this assignment. If you don't know anyone, Mike will help you find a partner. Submit one solution with both of your names on it.

Before Starting

Copy the lecture code that was developed in class on Wednesday, January 19th into a BlueJ project named inlab1.

Task 1: Javadoc (3 points)

Add appropriate Javadoc comments to the Row.java file. Be sure to use the following tags correctly: @author, @param and @return. You should verify that the Javadoc is being done correctly via the "Project Documentation" option in the BlueJ environment.

Task 2: Preconditions and Postconditions (2 points)

Add appropriate precondition and postcondition comments to the Row.java file.

Task 3: UML (2 points)

Draw an UML diagram of the Row.java file using MS-Word or some other program of your choice.

Task 4: Coding (3 points)

Add a new class called Answer to the project. This class should contain at least these two methods:

  1. A constructor with two integer parameters. The first represents the number of different pegs in the answer. The second represents the number of different colors that can be used.
  2. A method named createAnswer that randomly generates an answer.
Change Driver.java to take advantage of the class. Do not change Row.java at all.

What to Submit

E-mail your code and your UML diagram to Mike Thiesen at thiesen@cs.montana.edu in one message. The subject of the message should be: CS 221-xx inlab1 your names. The xx is the number of your lab section.

Before You Leave

Delete the inlab1 project that you created and the UML diagram. Empty the recycle bin. Thank you.