School of Engineering and Applied Science
Department of Computer Science
CSci 53 -- Introduction to Software Development
http://www.seas.gwu.edu/~csci53/spring05
Prof. Michael B. Feldman
mfeldman@gwu.edu

Lab Exercise #7
Froday, April 8, 2005

Objectives: This lab will help you understand and modify a course-specific class.

Part 1:

Copy and compile programs53/DateOps.java and programs53/DayTest.java. Now run DayTest. You'll notice that DayTest returns a number from 0 to 6. In this lab you will write two versions of DayTest (DayTestIf.java and DayTestSwitch.java). In DayTestIf.java, rewrite DayTest.java so that it returns the string representing the day (i.e. "Monday") instead of the number (i.e. 1). Solve the problem using if statements. In DayTestSwitch.java, do the same thing, but this time use a switch statement instead of if statements.

Notice that you have now solved part of your problem for the next project. You should be able to take the ideas you worked out in this lab and apply them to your own project code.

Print out copies of DayTestIf.java and DayTestSwitch.java and staple them to this lab handout for reference.

Part 2:

Modify DateOps by adding stubs for all the new methods. Annotate all the methods for javadoc and then run javadoc to produce documentation.

(end of lab)