Writing a program using the IF statement

I have to write a question usinf the IF statement.  I have to write a program to check whether or not a year inputted is or was a leap year.  A year is a leap year if it is evenly divisible by 4, except that any year divisible by 100 is a leap year only if is divisble by 400?
sniper4897Asked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

sniper4897Author Commented:
//Steven Zecca
package proj2stz;
import javax.swing.*;
public class LeapYear
{
  public static void main(String[] args)
  {
  String s1,s2,s3;
  int x,y;
  s1=JOptionPane.showInputDialog("Enter a year, please?");
  y=Integer.parseInt(s1);
  x=Integer.parseInt(s1);
  if(y/4=x)
  {
    System.out.println("x is a leap year");
  }
  else
  {
      System.out.println("x is not a leap year");
 
  }
  }
}
0
sniper4897Author Commented:
package proj2stz;
import javax.swing.*;
public class LeapYear
{
  public static void main(String[] args)
  {
  String s1,s2,s3;
  int x,y;
  s1=JOptionPane.showInputDialog("Enter a year, please?");
  y=Integer.parseInt(s1);
  x=Integer.parseInt(s1);
  if(y/4=x)
  {
    System.out.println("x is a leap year");
  }
  else
  {
      System.out.println("x is not a leap year");
 
  }
  }
}
this is what i have..but it doesn't work
0
msasikalaCommented:
if( (y%100==0 && y%400==0) ||(y%100!=0 && y%4==0))
{
     System.out.println("y is a leap year");
}
else{
      System.out.println(" y is not a leap year");
}
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.