/* Laboratory Assignment For Monday of Week of 4/10/04 1) Given a year find if it is a leap year. An year is leap yar if 1. It is divisible by 400 or 2. It is not divisible by 100 and it is divisible by 4. */ class Leap{ public boolean compare(int year) { if((year%400==0)||((year%4==0)&&(year%100!=0))) return true ; else return false ; } } class soln9mon1 { public static void main(String args[]){ MainWindow mainWindow; InputBox inputBox; OutputBox outputBox; int year; boolean out ; Leap b=new Leap(); mainWindow = new MainWindow("LEAP YEAR DETECTION"); mainWindow.setVisible(true); inputBox = new InputBox(mainWindow); outputBox = new OutputBox(mainWindow); year= inputBox.getInteger("Please enter the Year"); //str2= inputBox.getString("Please enter the second string"); outputBox.setVisible(true); out=b.compare(year); if(!out) { outputBox.printLine("THE YEAR IS NOT A LEAP YEAR " ); } else outputBox.printLine("THE YEAR IS A LEAP YEAR " ); } }