Here's how we get started:

class HomeworkOne {
  public static void main(String[] args) {
    System.out.print("Enter the first time: "); 
    System.out.print("Enter the second time: "); 
  }
}

Clearly we need to prompt for times in between: 

import java.util.*;                                          // [1]

class HomeworkOne {
  public static void main(String[] args) {
    Scanner a = new Scanner(System.in);                      // [2] 
    System.out.print("Enter the first time: "); 
    String t1 = a.nextLine();                                // [3] 
    System.out.println("You have entered: " + t1);           // [4] 
    System.out.print("Enter the second time: "); 
    String t2 = a.nextLine();                                // [5] 
    System.out.println("You have entered: " + t2);           // [6] 
  }
}

Now this program has extra code ([4], [6]) to make sure our code is so far correct. 

import java.util.*; 

class HomeworkOne {
  public static void main(String[] args) {
    Scanner a = new Scanner(System.in); 
    System.out.print("Enter the first time: "); 
    String start = a.nextLine(); 
    int t1 = Integer.parseInt(start.substring(0, 2)) * 60 +                          // [1] 
             Integer.parseInt(start.substring(3)); // starting time in minutes 
    System.out.println( start + " is " + t1 + " minutes from the start of the day"); // [2] 
    System.out.print("Enter the second time: "); 
    String stop = a.nextLine(); 
    int t2 = Integer.parseInt(stop.substring(0, 2)) * 60 +                           // [3] 
             Integer.parseInt(stop.substring(3)); // ending time in minutes     
    System.out.println( stop + " is " + t1 + " minutes from the start of the day");  // [4] 

  }
}

The new lines are [1] and [3]. Lines [2] and [4] are not essential, just keep us straight. 

This programs runs as follows: 

Welcome to DrJava.  Working directory is C:\Users\dgerman\Desktop\summer-2016-c212-6w2
> run HomeworkOne
Enter the first time: 12:47
12:47 is 767 minutes from the start of the day
Enter the second time: 20:36
20:36 is 767 minutes from the start of the day


Finally we can finish the program (as indicated by the navigator): 

import java.util.*; 

class HomeworkOne {
  public static void main(String[] args) {
    Scanner a = new Scanner(System.in); 
    System.out.print("Enter the first time: "); 
    String start = a.nextLine(); 
    int t1 = Integer.parseInt(start.substring(0, 2)) * 60 + 
             Integer.parseInt(start.substring(3));
    System.out.print("Enter the second time: "); 
    String stop = a.nextLine(); 
    int t2 = Integer.parseInt(stop.substring(0, 2)) * 60 + 
             Integer.parseInt(stop.substring(3));
    int d = (t2 - t1 + 24 * 60) % (24 * 60);                                    // [1] 
    System.out.println( (d / 60) + " hours and " + (d % 60) + " minutes." );    // [2] 
  }
}

There are only two new lines. 

Notice also there is no if. 

Here's how we test this program:

Welcome to DrJava.  Working directory is C:\Users\cogli\Desktop\summer 2016 c212 6w2
> run HomeworkOne
Enter the first time: 08:12
Enter the second time: 09:06
0 hours and 54 minutes.
> run HomeworkOne
Enter the first time: 08:56
Enter the second time: 19:59
11 hours and 3 minutes.
> run HomeworkOne
Enter the first time: 19:59
Enter the second time: 08:56
12 hours and 57 minutes.
> run HomeworkOne
Enter the first time: 23:59
Enter the second time: 00:01
0 hours and 2 minutes.
> run HomeworkOne
Enter the first time: 00:01
Enter the second time: 23:59
23 hours and 58 minutes.


So this is it. 

You will not lose points if you have used if statements instead.

However in this case you were supposed to follow the navigator (me) because I explained everything in detail. 

--