Question: Translate into Java the following pseudo-code, expressed in plain English. Goal: Write a method that returns true if the year passed as parameter year as
Translate into Java the following pseudo-code, expressed in plain English. Goal: Write a method that returns true if the year passed as parameter "year" as an int value is a leap year. The rules to determine whether a given year is a leap year or not are detailed below. Variables declarations & initialization: Boolean variable "result", initialized to false. Steps for the code: If the year is a multiple of 4 then consider the following additional conditions: If the year is not a multiple of 100 then set "result" to "true". Else, if the year is a multiple of 400, then set "result" to true, else, set "result" to false. Else, set "result" to false At the end of your method, return the value of "result". leap Year(1996) - true leap Year(2002) - false leap Year(2004) - true
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
