0

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

Edited by Reverend Jim: Fixed formatting

2
Contributors
1
Reply
2
Views
8 Years
Discussion Span
Last Post by Ezzaral
0

Well, the error message says why. Did you read it? It also indicates the line on which the error occurred.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.