View Single Post
Old 11-10-2010, 01:13 PM   PM User | #2
Fou-Lu
God Emperor


 
Fou-Lu's Avatar
 
Join Date: Sep 2002
Location: Saskatoon, Saskatchewan
Posts: 15,741
Thanks: 4
Thanked 2,465 Times in 2,434 Posts
Fou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to allFou-Lu is a name known to all
So far the only thing wrong with the class is the constructor. The UML lists that the constructor has no arguments, but this one has three. I'd chain them and keep both to give you an option:
PHP Code:
public Time()
{
    
this(000);

The displayMilitary will be the easiest to do. Its a simple print that separates each of the hour, minute and second variables with a colon. The settime method needs to enforce validation rules. Hour must be between 0 and 23, and minutes and seconds between 0 and 59. If either of these fail, reset all to 0. You can accomplish this by either checking the variables after all are set for errors, or using exceptions to try/catch and reset. And finally, the display standard needs to check if hour is > 12. If it is, subtract 12 and show pm instead of am.
The timeApp just has a main that has a few calls to the time class. I can't really say much else on that without doing it for you. Update what you have, and if you still have some problems than come back and post back what the problem is.
__________________
PHP Code:
header('HTTP/1.1 420 Enhance Your Calm'); 
Fou-Lu is offline   Reply With Quote