Here's the start of some code for a clock that can display time in 24 and 12 hours.
What could be added to it? How could I can apply notions such as OOP, model and Enums here?
public Clock {
private int time = 0;
public int get24hrTime(){
return time;
}
public int set24hrTime( int newTime ){
this.time = newTime;
}
public int get12hrTime(){
if( time - 12 < 0 ){
return time;
} else {
return time - 12;
}
}
public String get12hrPostfix(){
if( hours - 12 < 0 ){
return "AM";
} else {
return "PM";
}
}
}