This problem has 5 points Complete problems 411 and 419 in y
Solution
//Following program is in java
 import java.util.Calendar;
 import java.util.GregorianCalendar;
 import java.util.Scanner;
 public class DateDiff {
   public static void main(String[] args) {
        Scanner scan= new Scanner(System.in);
        System.out.println(\"Enter 1st day\");
        int dayFirst=scan.nextInt();//getting the first day
        System.out.println(\"Enter 1st Month\");
        int monthFirst=scan.nextInt();//getting the first month
        System.out.println(\"Enter 2nd day\");
        int daySecond=scan.nextInt();//getting the second day
        System.out.println(\"Enter 2nd Month\");
        int monthSecond=scan.nextInt();//getting the second month
       
        int year= Calendar.getInstance().get(Calendar.YEAR);//getting the current year from the calender
       
        GregorianCalendar gc = new GregorianCalendar();
        gc.set(GregorianCalendar.DAY_OF_MONTH, dayFirst);//setting the first day to the calender
        gc.set(GregorianCalendar.MONTH, monthFirst-1);//setting the first month to the calender. Index start with 0 hence minus with 1
        gc.set(GregorianCalendar.YEAR, year);//setting the year to the calender
        int num1stDay=gc.get(GregorianCalendar.DAY_OF_YEAR);//getting the nth day of the year
       
        GregorianCalendar gcSecond = new GregorianCalendar();
        gcSecond.set(GregorianCalendar.DAY_OF_MONTH, daySecond);
        gcSecond.set(GregorianCalendar.MONTH, monthSecond-1);//setting the second month to the calender. Index start with 0 hence minus with 1
        gcSecond.set(GregorianCalendar.YEAR, year);//setting the year to the calender
        int num2ndDay=gcSecond.get(GregorianCalendar.DAY_OF_YEAR);//getting the nth day of the year
       
        System.out.println(num2ndDay-num1stDay+\" day(s)elapsed between two dates\");//showing the difference of two days
       
        scan.close();
       
               
    }
}
/---------------------output-----------------------/
 Enter 1st day
 4
 Enter 1st Month
 1
 Enter 2nd day
 6
 Enter 2nd Month
 2
 33 day(s)elapsed between two dates
 /-------------output-----------------------/
Note: Feel free to ask question if any doubt


