// // Supporting material for lecture 3 // - String.format // import FormatIO.*; import java.util.Calendar; public class Demo03c { public static void main(String[] args){ double x = 3; int n = 3; float y = 3; String s = String.format("n = %d and x = %f and y = %f\n",n,x,y); System.out.println(s); System.out.println("n = " + n + " and x = " + x + " and y = " + y); // alternatively :) for (int i=0;i<6;i++){ n = n * 10; System.out.println(String.format("%7d",n)); } Calendar now = Calendar.getInstance(); System.out.println(now); } } // // foramtting // look at the difference between an integer and a double!! // - what's a float? // - what's a long? // - what's this Calendar stuff and where does it come from? // - is that a loop I see (for stuff)? // - yikes! n = n * 10 How can that be!!!!!!!! // // Write out formatted string for a time in 24 hour format // - read from console hours hh // - read from console minutes mm // - write out hh:mm where leading position is zero filled // // Could we validate this? // - 0 <= hours < 24 // - 0 <= minutes < 60 //