// How many days in the year? // Does this program have a bug? import java.awt.*; import java.applet.*; public class DaysInYear extends Applet { TextField yearTF = new TextField(5); Label daysLbl = new Label("Input year, press ENTER"); public void init() { add(yearTF); add(daysLbl); } public boolean action(Event e, Object o) { int year = Integer.parseInt(yearTF.getText()); daysLbl.setText("" + year + " has " + (365 + (isLeap(year) ? 0 : 1)) + " days."); return true; } boolean isLeap(int year) { return ( year % 4 == 0 && (year % 100 != 0 || year % 400 == 0)); } }