diff --git a/Week 1 Exercise 021 Leap Year/LeapYear b/Week 1 Exercise 021 Leap Year/LeapYear index 94c8bf4..1656ee9 100644 --- a/Week 1 Exercise 021 Leap Year/LeapYear +++ b/Week 1 Exercise 021 Leap Year/LeapYear @@ -9,16 +9,9 @@ public class LeapYear { System.out.print("Type a year: "); int thisYear = Integer.parseInt(reader.nextLine()); - boolean true4 = (thisYear%4==0); - boolean true400 = (thisYear%400==0); - boolean true100 = (thisYear%100==0); - - - if ((true400==true)&&(true100==true) && (true4==true)) { + if (thisYear % 400 == 0 && thisYear % 100 == 0) { System.out.print("The year is a leap year."); - } else if ((true400==false) && (true100==true)) { - System.out.print("This year is not a leap year."); - } else if (true4==true) { + } else if (thisYear % 4 == 0 && thisYear % 100 != 0) { System.out.print("This year is a leap year."); } else { System.out.print("This year is not a leap year.");