Validating a leap year

We need to use the parse Int() function of the Lang standard library to convert them into the integer type so that we can perform comparisons and mathematical operations easily afterwards: After that we check the day value. If the year value can be divided by 4, then it is a leap year.

Here is what I have so far but I keep getting validation errors from when the code is ran in the Test Harness.

Take your time and think thuroughly about each line of code while coding it, it will save you tons of time in the long run. What exactly do you expect statements like "month = month;" to do? Do you go to the bank and say " I have exactly .56 in my pocket, so I would like to deposite all .56 and then withdraw .56 and put it back in my pocket"? Teller would probably do it, but the teller would feel like he/she wasted time with you and that you are not really right in the head.

Java feels the same way when you make it do the same thing, and you love to do it. Code like the following is all wrong, and for more reasons than pointed out in hint 5.

and if the date was before the year 1582 it leaves the date as it was entered: mm/dd/yyyy i know that i need to use a switch statement. im not sure if i have the variables set right or if i even need the variables like that.

i need to get it to input the date as so: mm/dd/yyyy and then output the date as so: February 29, 2004 is a date in a leap year.

Doesn't make much sense in english, and it doesn't make much sense in Java either. I am pretty sure "year" is not the variable you want in the code snippet above (the one used in hint 3), especially considering years 1, 3, 5, 7, 8, 10, and 12 are not between 10.

You must have an account to comment. Please register or login here!