This programming assignment consists of designing a class and its interface. Specifically you should choose a class that you want to implement. The choice of which class is up to you. A class that is too simplistic will get less credit. (The coin class discussed in class.) However, do not try and choose to complicated a class as this becomes quite complex to handle.
A class should be an entity that stands (logically) by itself (meaning it is self-contained) independent of other entities. E.g., a television as we discussed earlier is an example of a class. (You can NOT not use a TV remote as your example as we have discussed this already. Also a VCR, radio, etc. is also too similar.) Similarly, an elevator has also been discussed in class and so can not be used.
Having chosen your class, define its members, and which, if any, will be public. Then lists the methods which will manipulate the members. These would be the public methods. (A private method is usually something created to simply the implementation of the class.) The public methods (and public members, if any) are frequently referred to as the interface. The list of the methods should be complete as possible. (That is why one should try and avoid too complicated classes.) Be consistent. That is to say, what one says in the ADT should be consistent with the interface description. E.g., in one states that a method, call if example, has an input of an integer and has no output, its description in the interface should be
void example(int)
Inconsistencies will be penalized in the grading. An example of what your class definition would look like is the TV class definition.
Your class must have a constructor class.
You should hand in one file, which should contain both the ADT and the UML.
The UML should list the members of the class and the methods (including the constructor) with their protocol or signature. That is to say, it should indicate if it is private or public, it's list of parameters, and what data type it returns. You can do this as part of a Java program or just as a list of them.
The ADT (Abstract Data Type) will list the methods (indicating which, if any, are private), and for each method, the five conditions, (1) preconditions, (2) input variables, (3) process (what it does in at most a few sentences in English), (4) output variables, and (5) postcondition. Note that some of these (except the process) might be empty. See the abstract data type of a TV for an example of this.
So what you are to create is the interface of a class and its ADT.
You do not implement the class. You just define it. By implementing, I mean you do not have to write the code for each method, just its interface.
You should post your project as file on the COL website. It should be posted under the appropriate assignment. Also indicate how many hours you worked on the program in the file.
Homepage of CTI School
back to 211
homepage