CMPS271 Project 10 Classes Suppose you are given a class nam
Solution
   public void advance(int m)
    {
        // as long as there are m are available to be added
        while(m>0)
        {
            // if minutes is 59 we need to increase the hour and minutes will be 0
            if(minute==59)
            {
                hour++;
                minute = 0;
            }
            // simple case of increasing minutes
            else
            {
                minute++;
            }
           
            // if hour has become 12 and there is 0 as mins, then we need to change AM to PM and vice versa
            if(hour == 12 && minute == 0)
            {
                //System.out.print(day);
                if(day == \"AM\")
                    day = \"PM\";
                else
                    day = \"AM\";
            }
           
            // if hours becomes 13, it should be 1
            if(hour==13)
            {
                hour = 1;
            }
           
            // everytime reducing m by 1
            m--;
        }
    }
   public boolean isWorkTime()
    {
        // hours are less than 9 AM then it is false
        if(day ==\"AM\" && hour<9)
            return false;
        // greater than 5 PM
        if(day==\"PM\" && hour >=5 && minute > 0)
            return false;
        // if not returning true
        return true;
    }

