Hello, Im new to Java, so expect the worst programming ever, hahaha. Im trying to create a program that calculates if the year entered is a leap year, also I need it to reloop and ask to enter another year, or enter a specific number to exit, I know it probably has something to do with sentinel values. Here is my lame source code, please excuse its sloppyness. It compiles right, except I get its not a leap year everytime, for any year, haha, something is probably wrong with the year%100 !=0, hahaha.
import javax.swing.*;
// This program takes a year given and tells you if it is a leap year
public class Hw2
{
public static void main( String[] arg )
{
double year;
year = Integer.parseInt( JOptionPane.showInputDialog("Please enter the year: \n" + " or -99 to Quit" ) );
if(( year % 4 == 0) && (year % 400 == 0) && (year % 100 != 0 ))
JOptionPane.showMessageDialog( null, year + " is a leap year" );
else
JOptionPane.showMessageDialog( null, year + " is not a leap year" );
System.exit( 0 );
}
}