From 5a55ed26ee89a8d83ffd7e3501830b8a23f95c45 Mon Sep 17 00:00:00 2001 From: safomatic <33205940+safomatic@users.noreply.github.com> Date: Mon, 14 Oct 2019 15:17:54 -0400 Subject: [PATCH] Update LeapYear Changes submitted to add clarity to the solution. --- Week 1 Exercise 021 Leap Year/LeapYear | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) 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.");