// // Supporting material for lecture 11 // - helper methods // - validating time, again :) // read in two times and then do soemthing with them!!! // import FormatIO.*; public class Demo11 { private static boolean validTime(int x){ return x > 0 && x/100 < 24 && x%100 < 60; } public static void main(String[] args){ Console con = new Console(); int firstTime = -999, secondTime = -999; while (!validTime(firstTime)){Discuss, how ca con.print("Enter first time: "); firstTime = con.readInt(); } while (!validTime(secondTime)){ con.print("Enter second time: "); secondTime = con.readInt(); } con.println("Diff: " + (firstTime - secondTime)); // (9) } } // // method tests if time is valid // note parameter passing and what method returns // why bother? // - neater? // - easier to get right? // - easy to reuse (as a tool) // Can you make diff (9) more sensible? // - write a diff method? // // NOTE: variable names, initial values and why we choose these, //