CSE logo University of Washington Department of Computer Science & Engineering
 CSE 142 Winter 2003 -- Project #1
  UW Home     CSE Home   Message Board    Contact Info 

CSE 142
 Home page
 Syllabus
Classwork
 Calendar
 Homework
 Projects
 Exams
 Quizzes
Software & Computing
 Programming Lab Info
 Computing at Home
 Java Libraries
 Troubleshooting
Staying in Touch
 Discussion Board
 Virtual TA
 Announcement Archive
 Mailing Lists
Staff
 Instructors
 TAs
 Consultants
 Consultant Schedule
Check Your Scores
 MyUW
   

CSE 142 Project #1

Part A Due With Homework 3: Sunday, February 2 at 9:00 PM

Project Code Due: Sunday, February 9 at 9:00 PM

Individual Written Reports Due: Wednesday, February 12 at 9:00 PM

Directions: You should complete all design work, specification, coding in Java, testing of code, and code documentation with your assigned partner. Please work with your partner on all components in front of the same computer using the pair programming style described in the Williams/Kessler paper and demonstrated in lecture. When working on the computer, you should normally switch roles every 10 or 15 minutes. One person is the driver (the person controlling the keyboard and mouse) while the other is the navigator. The navigator should help the driver by pointing out flaws in specification, code, and documents. The navigator also keeps track of your goals and helps the team accomplish steps to reach those goals. We ask that you work on projects in this manner so you learn to work with another student in the course and you learn to assist one another. Each member will bring strengths to the team. We hope you learn how to complement your strengths and the strengths of your partner to complete this project.

When you are finished with the project, you will turn in one set of Java files for the team. Each member should be satisfied with the content of these files. You may submit project files more than once. We will grade the final set of files you submit electronically.

Once your team is finished with the Java files, each member of the team will write a project report individually and submit this by Wednesday, February 12. Details about what should be included in project reports can be found on this web page. Please read through the project report guidelines as you work on your project; the guidelines will help you take notes about the project as you complete the steps. Use this project report turnin page to submit your report.

Grading guidelines: Your team will receive the same grade on the Java programming part of the project. Your code will be graded on a scale from 0 to 4 in two categories:

  • Design, specification, implementation, code style, and test cases used (code quality)
  • Functionality of code and adherence to project specifications (code operation)

You will receive an individual grade based on your written report. Your written report will be graded on a scale from 0 to 4 in two categories:

  • Technical content of the written report
  • Writing style

The project is worth a total of 16 points. You can find more details about how this and future projects will be evaluated in this grading guide.

Project Specification:

Interiors By Design has hired your team to create an application that displays configurations of floor tiles. Customers who use this system can see how tile patterns would look before purchasing and installing the physical tiles in their rooms. An example tiling is a grid layout containing the same tile. Interiors By Design has asked you to create a system that will display common patterns of floor tiles. As designers of the system, you will create the graphics of the floor tiles and display the floor patterns. You may be as creative as you wish!

Part A:

1. Your first task is to complete the specification and implementation of the Tile class. A partially written version of this is supplied by us in file Tile.java (you might need to right-click on the link to download the file). You need to complete this class by implementing the constructors and the addTo method, which means you need to start by reading the comments and code to understand what is already there. You can add additional properties and responsibilities to this class if you wish to make a more interesting Tile design.

To keep the design simple, all tiles will be squares with a fixed size, which is the length in pixels of each side. Also, all tiles will have the same basic graphic design, which is up to you. You should use the shapes included in the uwcse graphics library to create your tile graphic. (See the Java documentation links on the course web pages for descriptions of this library.) Different instances of the tile class can have different colors, so the color(s) of the tile should be specified as constructor arguments when a tile is created. If your Tile contains a more elaborate pattern made from various shapes (ovals, rectangles, triangles, etc.), you may want to have methods and instance variables to set and remember the colors of different parts of the tile.

A Tile is responsible for drawing (adding) itself to a floor, which is represented by a GWindow, the basic graphics window in the uwcse.graphics library. This should be done in method addTo, which has three parameters: the rectangular floor (GWindow) where the tile is to be drawn, and the row and column number on the floor where the drawing should appear. The tile drawing should be composed from of one or more Shape objects (see the uwcse.graphics documentation).

A tricky part is the coordinate systems. Method addTo is supposed to add a tile to the floor at a particular row and column. However, the actual graphic object needs to be placed at a particular pixel location in the graphics window. Class Tile has a private method, display, that is meant to handle the details of coordinate conversions. When you design your Tile, you should figure out the Shapes to be drawn assuming that the upper-left coordinate of the Tile is located at coordinate (0,0). Method display can then be used to relocate the Shape to the right coordinates for the particular row and column, and then add it to the graphics window at that location.

2. The other class that you must complete is the Pattern class, which is contained in file Pattern.java. This class is responsible for knowing the size of the floor and displaying various tile patterns on the floor. Right now, the Pattern class simply initializes the floor by creating the drawing window. It also contains a method that draws grid lines showing the locations of the tiles on the floor. Try creating a new Pattern object and initializing the floor of the with the gridlines (use the interactions window to experiment with this.)

The starter version of the Pattern class has a method displayTopLeft that draws a single tile in the top-left corner of the floor. For part A of this project, you should add a method displayAllSame to class Pattern that has a single Tile object as its parameter and draws that tile on every square on the floor. (In other words, add a method that draws a single tile repeatedly in every square, instead of just drawing a single tile in the top-left corner.)

3. Be sure to test the Pattern class by creating a Pattern object, creating a Tile object, and adding this Tile object to the floor by invoking the method displayAllSame. Hand in your modified Tile and Pattern classes by submitting the files along with your Homework 3 assignment (see the homework 3 turnin page). Each partner should submit the code in his or her homework.

Part B:

1. Interiors by Design would like you to add methods to class Pattern that draw Tiles in the following patterns:

  • checkerboard pattern (alternating tiles across and down)
  • horizontal stripe pattern
  • vertical stripe pattern
  • border pattern (one tile on edge of floor, a different tile in the middle of the floor)

If W denotes a white tile and B denotes a black tile, here are examples of the above patterns on a 4 by 6 floor:

Checkerboard:                                            Horizontal Stripe:

W    B    W    B    W    B                            W    W    W    W    W    W

B    W    B    W    B    W                            B      B     B     B     B     B

W    B    W    B    W    B                            W    W    W    W    W    W

B    W    B    W    B    W                            B     B     B      B      B     B

Vertical Stripe:                                            Border:

W    B    W    B    W    B                            W    W    W    W    W    W

W    B    W    B    W    B                            W    B      B      B     B    W

W    B    W    B    W    B                            W    B      B      B     B    W

W    B    W    B    W    B                            W    W    W    W    W    W

2. Test to make sure these patterns work on various sizes of floors.

3. Design two additional patterns of your choice and implement these in the Pattern class. Write clear comments in the code explaining the patterns you are creating.

4. Test out all patterns and different instances of the Tile class.

For the code submission, please turn in three files. Submit your final specification and implementation of the Tile class in Tile.java. Submit your final specification and implementation of the Pattern class in Pattern.java. Also, submit a file called Test.txt that contains code you used to test your classes. Just copy and paste code from the interactions window into a plain text file (Notepad works for creating plain text files).Because of the way the turnin server operates, this file must have a name that ends with .txt. Use this turnin form to submit the three files for Part B.

5. Additional Enrichment [If you have time, please feel free to add the following components to your application.]

  • The application so far allows patterns of tiles that have edges parallel to the floor edges. Add another method to the Tile class that adds a rotated version of the tile to the floor. You may need to add a method for displaying the rotated tile in the row and column. Consult the documentation about the uwcse graphics library to see how you might rotate a shape. You may need to adjust how you handle rows and columns.
  • Create a new class called CompositeTile that consists of many tiles laid out together. For example, CompositeTile may represent four individual tiles. Add methods to the Pattern class to display CompositeTile objects in the patterns.
  • Create tiles of various sizes. Some may have sides of length 50 and some may have sides of length 100. Modify the Tile class and Pattern class to account for layout of different sizes of tiles.


CSE logo Department of Computer Science & Engineering
University of Washington
Box 352350
Seattle, WA  98195-2350
[comments to cse142-webmaster]