I would like to have your advice about the way I have designed the application
Joined: Jan 15, 2007
Below is the source code and the description of a Digital Clock application I created, I would like to have your advice about the way I have designed the application, I was influenced by the Digital clock application in the Book Objects first with Java byDavid J Barnes and Michael Kolling.The Clock calss creates two objects of the Hour and Minute classes and both of which creates two objects of Display class.The Clock class calls methods of Hour and Minute classes as approproate and in turn the objects of Hour and Minute call on the methods of the two Display objects they created
PROJECT TITLE: Digital Clock
PURPOSE OF PROJECT: Simulate a Digital Clock
VERSION or DATE: 23-April-2009
HOW TO START THIS PROJECT: Create an object of Clock(Use BlueJ to execute the project)
AUTHORS: Varuna Seneviratna
USER INSTRUCTIONS: If you want to change the format of the time displayed change the
parameters of the constructor where creating the Display object
(in the constructors of Hour and Minute classes), which will decide the format of the time displayed
The source code Clock class
Joined: Nov 07, 2008
Your code is object oriented, it's easy to read, and it works (I assume)... so I'd say congrats
I do think its overkill though... you could have written a program to do the exact same thing in less than 10 lines without the extra objects. Also, you never used the Date class... so it's not functional.
For a practice program though I like it... you've used a lot of different objects each which controls it's own properties
EDIT: On second thought, you would use the Calendar class... not the Date class which I had stated. Let me know if you'd like to see an example.
~Currently preparing for SCJP6
Joined: Oct 13, 2005
Are you sure you need Hour and Minute classes? Can you use Display classes with maximum (hour = 23, minute = 59) fields instead?