CSSE 220 – Object-Oriented Software Development

Homework 14

Objectives

More practice with interfaces and implementing them. Some practice with GUIs.

Tasks

  1. No new reading assignment.  Catch up if you are behind on reading the textbook.
  2. Programming from last time: Finish the BigRational exercise from Homework 13. If you followed the suggestion to write seven of the methods before today's class, this should only take you a few more minutes.
  3. More Programming:
    1. Your programming work for this part must be done in the EventBasedProgramming project inside Eclipse. Use the SVN Repository Exploring perspective to check out this project, then switch back to the Java perspective.
    2. In-class exercises:
      1. Complete the TODO items in slides.BreakfastMain.
      2. Complete the TODO items in the new edu.roseHulman.csse220.charges.ChargeMain.
    3. Board Games: (10 points) The package boardGames contains an interface Game for two-player board games with a graphical interface. An implementation of TicTacToe based on this interface is provided, as is a GameRunner component and a main class, GameMain. You have four tasks, two of which are optional.
      1. Add an ActionListener for the Quit button, according to the TODO item in GameMain.
      2. Add a MouseListener for the game runner according to another TODO item in GameMain. Your mouse listener should be fairly simple. Just get the location of a mouse click and call the appropriate GameRunner method.
      3. (3 points) Bonus: Create a new Game implementation for the Game of Nim. You should create a new class that implements Game. Write code for all the required methods, studying TicTacToe as an example. Change the value of the constant THE_GAME in GameMain to use your new class. This should be the only change you need to make to the existing code for your new game to work.
      4. (3 points) Another Bonus: Create a new Game implementation for Dots and Boxes, following the recommendations from the previous item.

Turn-in Instructions

Turn-in your programming work by committing it to your SVN repository.