<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">/** Small exercises on developing methods dealing with time formats.*/
public class Methods {
    
   /** Time formats:
        1. 24-hour-string:  "hours&gt;:&lt;minutes&gt;"
                             &lt;hours&gt; is in range 0:23 and &lt;minutes&gt; is in range 0..59
                             Examples: "4:20"  "13:00"   "23:59"
                             
        2. AM-PM-string:    "&lt;hours&gt;:&lt;minutes&gt;AM" or "&lt;hours&gt;:&lt;minutes&gt;PM"
                             &lt;hours&gt; is in range 0:11 and &lt;minutes&gt; is in range 0..59
                             Examples: "4:20AM"  "3:00PM"   "11:59PM"  "0:0"
                             
        3. 24-hour-verbose  Example: "4 hours and 20 minutes"
                                     "23 hours and 5 minutes"
                             Note: exactly one blank between each of the pieces
        
        4. 24-hour-correct  Exactly like the 24-hour-verbose format except that
                            it is gramatically correct. So, instead of
                            "1 hours and 20 minutes" it reads "1 hour and 20 minutes"
                            and instead of
                            "0 hours and 1 minutes" it reads "0 hours and 1 minute"
                            
        Note: if a String s contains only digits (not even blanks), then the
        function call Integer.parseInt(s) yields the integer represented by s. 
        For example, Integer.parseInt("345") is 345. */
    
    /** s is a time in the 24-hour-string format;
        Return the same time in 24-hour-verbose format */
    public static String toVerbose(String s) {
        return "";
    }
    
    /** s is a time in the 24-hour-string format;
        Return the same time in AM-PM format. */
    public static String ToAMPM(String s) {
        return "";
    }
    
    /** s is a time in 24-hour-string format;
        Return the same time in 24-hour-correct time
     */
    public static String timeToCorrect(String s) {
        return "";
    }
    
    /** s is a time in AM-PM-string format;
        Return the same time in 24-hour-string format.*/
    public static String eliminateAMPM(String s) {
        return "";
    }
    
    /** s is a time in EITHER the 24-hour-string format OR the 
        AM-PM-string format;
        Return the same time in the 24-hour-string format*/
    public static String removeAMPM(String s) {
        return "";
    }
    
    /** s is a time in the 24-hour-string format;                 
     Return the time as the number of minutes. E.g. "14:35" is 14*60 + 35.
     */
    public static int timeInMinutes(String s) {
        return 0;
    }
    
    
    /** s is a time in the AM-PM-string format;                   
     Return the time as the number of minutes. E.g. "14:35" is 14*60 + 35.
     See if you can write the body as a single return statement.
     */
    public static int AMPMtimeInMinutes(String s) {
        return 0;
    }
    
    /** = time s1 &lt; time s2;
          Precondition: s1 and s2 are in either 24-hour-string format
          or AM-PM-string format 
          See if you can write the body as a single return statement. */
    public static boolean isLess(String s1, String s2) {
        return false;
    }
    
    
}</pre></body></html>