package com.example.model;

/** The convertToHoursd class converts a string of minutes into a string in military time 
  * @author Adam Christian
  * 
  */
public class convertToHours{

   private String results;
   
   /** Default Constructor, sets the result variable to NULL
    * @author Adam Christian
    * @param None
    */           
   public convertToHours(){
      results = "";
   }

   /** toHours will convert the string of minutes into a string of military time
    * @author Adam Christian
    * @param String minutes
    * @return String
    */            
   public String toHours(String minutes){
   
      /* Turn the string into an Integer */
      Integer makeInt = Integer.valueOf(minutes);
      
      /* Get the hours */
      Integer hours = makeInt / 60;
      Integer mins;
      int temp;
      Integer temp2;
      
      /* Check if there are any minutes to add in */
      if(makeInt % 60 != 0){
         mins = makeInt % 60;
      }
      
      else{
         mins = 0;
      }
      
      /* Create the result string */
      if(hours < 10){
         results = "0";
         results += hours.toString();
      }
      
      else{
         results = hours.toString();
      }
      
      results += ':';
      
      if(mins < 10){
         results += "0";
         results += mins.toString();
      }
      
      else{
         results += mins.toString();
      }
      
      /* Add the seconds */
      results += ':';
      results += '0';
      results += '0';
   
      return (results);
   }
} 

