A computer program is to be developed to be used in clocks. Here is a class definition for this program
public class Time
{
public int hour;
public int minute;
public boolean isMorning;
}
Enhance the above class definition by providing two constructors: one that allows a time to be set to given values; and another that sets a default time of 1 O’clock in the morning.
heres my code:
public class Time
{
public int hour;
public int minute;
public boolean isMorning;
public Time()
{
int hour= 1;
int minute= 00;
}
public Time(int h, int m)
{
hour=h;
minute=m;
}
public void printTime()
{
System.out.println(hour + ":" + minute);
}
}
would my code be right?
i keep getting error messages which i dont understand why
thanks