Fundamentals of Computer Science II (CSC-152 2000S)


Project, Phase 3: Interfaces, Revisited

Assigned: Monday, March 6, 2000
Due: Monday, March 13, 2000

This assignment is intended to get you further in the design of the project.

As we saw in our discussion, there are various understandings of what the different components of the project need to do and how those parts will interact. Your goal for this part of the project is to resolve those differences. In particular, you will build a Java interface (as assigned below) for some classes related to your part of the project and implement a stub class for each of those interfaces.

A Java interface is a list of function declarations, but not definitions. For example,

public interface Point
{
  /** Get the x value of this point. */
  public double getX();

  /** Get the y value of this point. */
  public double getY();
} // interface Point

You can then provide multiple implementations for the same interface. For example,

/** A point represented using radians and radisu. */
public class CircularPoint 
  implements Point
{
  double angle;
  double radius;

  public double getX() {
    return Math.cos(this.angle) * this.radius;
  }
  
  ...
} // class CircularPoint

A stub class is a temporary implementation of an interface which is used for testing by other classes. For example,

public class StubPoint
  implements Point
{
  public double getX() {
    return 0.0;
  }
  public double getY() {
    return 0.0;
  }
} // class StubPoint

The two interface teams have a slightly different task. Team Texas should try to get working code for presenting a rough version of their interface. (This code need not react to button presses or anything.) Team Ahk should make sure that all their prompts work correctly and start working on a ``TextualHumanPlayer'' class.

History

Monday, March 6, 2000


Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors.

This page may be found at http://www.math.grin.edu/~rebelsky/Courses/CS152/2000S/Project/phase.03.html

Source text last modified Mon Mar 6 08:53:45 2000.

This page generated on Mon Mar 6 08:57:15 2000 by Siteweaver. Validate this page's HTML.

Contact our webmaster at rebelsky@grinnell.edu