Com S 362 --- Object-Oriented Analysis and Design HOMEWORK 2: IMPLEMENTING ADTS IN JAVA (File $Date: 2003/01/21 18:55:16 $) Due: January 29, 2003. The purpose of this homework is to have you learn how to implement classes in Java, and to get a feel for a sensible ADT design. You will also learn how to run JUnit tests. This is an individual homework, and is not to be done in teams. READINGS Read chapter 2 of Ken Arnold, James Gosling, and David Holmes's book The Java Programming Language Third Edition (Addison-Wesley, Reading, Mass., 2000). If you are new to Java you might also want to read the interesting (to you) parts of the "new to Java" section on-line at http://developer.java.sun.com/developer/onlineTraining/new2java/ 1. (100 points) [TimeOfDay and Appointment] Copy the Java files in the directory /home/course/cs362/public/homework/hw2/cal to a package named "cal" in an Eclipse Java project, or to a directory named "cal" if you aren't using Eclipse. This directory is also available from the course web page. You are to correctly implement the classes TimeOfDay and Appointment. Do this by filling in all of the method bodies in the files TimeOfDay.java and Appointment.java. You will have to add some private fields, and you can also add any (private, helper) methods that you might need. In the directory are also two JUnit test classes. Use these to test your code. HINTS Use Eclipse. Read the books and other information about Java as needed. TESTING Your code should compile, and run correctly under Java 1.4.1 (or 1.3.1, which you may have to use if you have a Mac). Test your program using our JUnit test classes. WHAT TO HAND IN Hand in a printout of all of the code you wrote. By doing this you certify that your code works correctly. If your code does not work correctly you can still hand it in for partial credit, but attach an explanation of what about it does not work. GRADING You will be graded, in part, on how clear your code is. Excessively long code will be penalized: don't repeat code in multiple places, don't write the same expression in multiple places. Be sure your code has javadoc comments for all fields and methods that you add. Your code should be sensibly indented so it is easy to read (Eclipse can do this for you automatically.) It's important to get all of our test cases to pass. Make all of the fields in the classes you write private. Be sure your name is in the comments in your code.