// Code for answering questions in Test1 Fall16 public class Test1Fall16 { public static void main(String[] args) { int value1 = 0, value2 = 0; int mmdd1, mm1, dd1; int mmdd2, mm2, dd2; Scanner input = new Scanner(System.in); System.out.println(" Enter a date value giving month and day. Enter the date as one \n integer representing month then day. Use two digits for day \n and two digits for month filling with 0 as needed for the \n month and day in the format MMDD: "); mmdd1 = input.nextInt(); System.out.println( "Enter a second date in the same year using the same format MMDD: "); mmdd2 = input.nextInt(); //Write the code to use the mmdd input and get values for mm and dd separately mm1 = // Get the mm1 value from mmdd1 dd1 = // Get the dd1 value from mmdd1 mm2 = // Get the mm2 value from mmdd2 dd2 = // Get the dd2 value from mmdd2 value2 = mm2 - mm1; if (value2 == 0) { value1 = dd2 - dd1; } else if (value2 > 0) { value1 = 0; if (mm1 == 2) { value1 = 28 - dd1; } else if (((mm1 == 4) || (mm1 == 6)) || ((mm1 == 9) || (mm1 == 11))) { value1 = 30 - dd1; } else { value1 = 31 - dd1; } int m1 = mm1; while (m1 < mm2) { switch(m1) { case 4: case 6: case 9: case 11: value1 += 30; break; case 2: value1 += 28; break; default: value1 += 31; break; } m1++; } value1 += dd2; } if (value2 >= 0) { System.out.println("The value calculated for "+mmdd1+" and "+mmdd2+" is "+value1); } else { System.out.println("The input was invalid"); } } // main