CSSE 220 – Object-Oriented Software Development

Homework 16

Objectives

Practice with designing and implementing classes. Learn to use the UMLet tool for drawing UML class diagrams.

Tasks

  1. Complete the assigned reading for session 16 (Session 16: Big Java, Ch. 8), according to the course schedule.
  2. Complete the assessment exercises over this reading on ANGEL (under Lessons → Assignments).
  3. Install UMLet: Download and install the UMLet program for drawing UML diagrams by following these instructions.
  4. Written exercises: You should write your answers to these questions neatly on paper, or type and print your answers if you prefer. Your UML class diagrams should be done using UMLet.

    1. Suppose you were going to implement a program to let two people play chess against each other. Think about what classes you would need. (Search on-line to find the rules of chess if you aren’t familiar with the game.) List all the classes that you can think of that might be useful in implementing your program. You can assume that users will enter moves in the console.
    2. From your list of potential classes, decide which ones you would use in an actual implementation. Pay particular attention to the rules for good classes that we discussed in class. Using UMLet, draw a UML class diagram for your classes. Show the public interface (i.e., methods) of each class and the dependency relationships between the classes. Recall that dependency relationships are indicated by dashed lines with open arrow heads.
    3. Write a couple of paragraphs explaining why you chose the classes that you did for your design. Discuss the cohesion and coupling of your classes.
    4. Bring a hard copy of your work on this problem to your next class.
  5. Programming:
    1. Your programming work for this part must be done in the chess package in the  DesigningClasses project that you checked out in class today.
    2. Create classes based on our your design for the Chess program. Create constructor and method stubs for your design and add javadocs. You do not have to actually implement the constructors and methods at this time, though you may do so if you find that interesting.
  6. More Programming: Complete the Polygon program in polygon package in the DesigningClasses project that you checked out and began working on in class today, as follows:
    • Run the program.
    • Note that the least/most number of sides data is shown, but is -1 (not yet implemented).
    • Read all the TODO’s in the Polygon class.
    • Do and test the TODO’s for most number of sides, asking questions as needed.
    • Do and test the TODO’s for least number of sides.
      • You might find Integer.MAX_VALUE helpful.

Remember, in all your code:

Here is the grading rubric for this assignment.

Turn-in Instructions

Turn in your programming work by committing it to your SVN repository for this project. Bring your written work to class.