I am a beginning self taught programmer. I was thinking this would be a good exercise to get used to program control statements. This is an attempt to write a program that returns the number of days between two dates. Sadly, it give incorrect values and after hours of trying to figure out what is wrong, I was hoping someone would help me. I will accept any form of help and criticism to help me improve. Thank you

Code java:

public class DaysBetweenDates { public static boolean isLeapyear(int year) {//This method will determine if a year is a leap year or not boolean isTrue=false; if(year%4==0 && year%100!=0) isTrue=true; else if(year%400==0) isTrue=true; return isTrue; } public static int computeDaysLeftInYear(int year1,int month1, int day1) {//This method is supposed to compute the days after the first date in //the first year int daysInYearOne=0; switch(month1) {//The purpose of this switch is to get the day remaining in the first month and store them in the variable daysInYearOne case 1: daysInYearOne=31-day1; break; case 2: if(DaysBetweenDates.isLeapyear(year1)) daysInYearOne=29-day1; else daysInYearOne=28-day1; break; case 3: daysInYearOne=31-day1; break; case 4: daysInYearOne=30-day1; break; case 5: daysInYearOne=31-day1; break; case 6: daysInYearOne=30-day1; break; case 7: daysInYearOne=31-day1; break; case 8: daysInYearOne=31-day1; break; case 9: daysInYearOne=30-day1; break; case 10: daysInYearOne=31-day1; break; case 11: daysInYearOne=30-day1; break; default: daysInYearOne=31-day1; } switch(month1+1) {//This switch is supposed to get the values of the days in the month for the rest of year one stored inside the variable case 2: //daysInYearOne if(DaysBetweenDates.isLeapyear(year1)) daysInYearOne+=29; else daysInYearOne+=28; case 3: daysInYearOne+=31; case 4: daysInYearOne+=30; case 5: daysInYearOne+=31; case 6: daysInYearOne+=30; case 7: daysInYearOne+=31; case 8: daysInYearOne+=31; case 9: daysInYearOne+=30; case 10: daysInYearOne+=31; case 11: daysInYearOne+=30; default: daysInYearOne+=31; } return daysInYearOne; } public static int computeDaysFromYearsInbetween(int year1, int year2) {//This method is supposed to find the days in the whole years that lie int daysInbetweenYears=0; // between the partial years for(int i=year1+1;i<=year2-1;i++) { if(DaysBetweenDates.isLeapyear(i)) daysInbetweenYears+=366; else daysInbetweenYears+=365; } return daysInbetweenYears; } public static int computeDaysBeforeDate(int year2, int month2, int day2) {//This method is supposed to find the days in the last year by using int daysInYearTwo=0; //the first method. I was trying to follow the never repeat yourself principle if(DaysBetweenDates.isLeapyear(year2)) daysInYearTwo=366-DaysBetweenDates.computeDaysLeftInYear(year2,month2,day2); else daysInYearTwo=365-DaysBetweenDates.computeDaysLeftInYear(year2,month2,day2); return daysInYearTwo; } public static void main(String[] args) { int v1=DaysBetweenDates.computeDaysLeftInYear(2012,1,1); int v2=DaysBetweenDates.computeDaysFromYearsInbetween(2012,2013); int v3=DaysBetweenDates.computeDaysBeforeDate(2013,12,31); System.out.println( v1+v2+v3); } }