RU beehive logo ITEC Department logo
ITEC 120
2007spring
ibarland,
jpittges

homeinfoexamslectureslabshws
RecipeLawsliessyntaxjava.lang docsjava.util docs

hw-ec01-ClockDisplay
Program organization
hw-ec01

Due Mar.20 (Tue after spring break) 17:00;
15pts.

A general note on extra-credit homeworks:

ClockDisplay12: another approach

Modify ClockDisplay so that instead of keeping track of time internally as hours-since-midnight, it keeps track of time internally in a 12-hour format. (Realize that the internal information kept by our class is different from what methods and fields we have.) This will make it easier for the ClockDisplay to give people a string in 12-hour format, but it will make it more difficult to update the time for each timeTick.

Of course, you'll want to write stub functions and test case for each of these two new classes. The following is an example, but it is not anywhere near a complete set of test cases.

ClockDisplay12 c = new ClockDisplay12();
c.getTime12() = "12:00am"
c.getTime24() = "00:00"
c.timeTick();
c.getTime12() = "12:01am"
c.getTime24() = "00:01"
c.setTime( 1, 23,        );   // You get to decide how the user will specify am vs pm.
c.getTime12() = "1:23pm"
c.getTime24() = "13:23"
Observe how, with the exception of setTime, these same cases could have been called with our original ClockDisplay from hw05.

You may wish to look at the hw05 solution, once posted. You may build on top of your hw05-soln or the published version (or neither), but be sure to indicate author (including yourself) and credits (to the book and, possibly, the posted solution) in the program's opening comments.

Also turn in a paragraph comparing the two implementations (for hw05 and this assignment). Which seems easier to write? Is it easier to understand the organization of one approach or the other?
By the way, I suspect that the approach required here is what the book probably expected for 3.30, and the approach on hw05 was what they hinted at in 3.31.

homeinfoexamslectureslabshws
RecipeLawsliessyntaxjava.lang docsjava.util docs


©2007, Ian Barland, Radford University
Last modified 2007.Aug.27 (Mon)
Please mail any suggestions
(incl. typos, broken links)
to iba�rlandrad�ford.edu
Powered by PLT Scheme