T
tabletcorry
In upgrading from Netbeans 3.6 to 4.0 some code that I had already
written for my Computer Science class became disfunctional.
The code is
//This is a program to determine whether or not a user entered year is
a leap year on the Gregorian Calender
package GPP3;
import cs1.Keyboard;
public class GPP3_03 {
public static void main(String[] args) {
final int LEAP_NUM=4,LEAPCK1=100,LEAPCK2=400,GREGCK=1583;
int year, id=0;
System.out.print("Please enter the Year to be checked: ");
year=Keyboard.readInt();
while (year != 0) {
if (year%LEAP_NUM==0)
id=1;
if (year%LEAPCK1==0){
id=0;
if (year%LEAPCK2==0)
id=1;
}
if (year<GREGCK)
id=3;
if (id==1)
System.out.println("The year is a leap year");
else
if (id==0)
System.out.println("The year is not a leap year");
else
System.out.println("The Gregorian calender was not
created by that time");
System.out.print("Please enter the Year to be checked (0 to
exit): ");
year=Keyboard.readInt();
}
}
}
The cs1 class is used to given to us by the writers of the book and is
used to get input from the user.
THe cs1 code is here
http://duke.csc.villanova.edu/jss/downloads/Keyboard.java
For some reason when the code is run in netbeans it returns
Error reading int data, MIN_VALUE value returned.
which it never did in version 3.6
While I can always go back to 3.6, the newer version has sever great
features that I would like to use
Any help would be greatly appreciated
written for my Computer Science class became disfunctional.
The code is
//This is a program to determine whether or not a user entered year is
a leap year on the Gregorian Calender
package GPP3;
import cs1.Keyboard;
public class GPP3_03 {
public static void main(String[] args) {
final int LEAP_NUM=4,LEAPCK1=100,LEAPCK2=400,GREGCK=1583;
int year, id=0;
System.out.print("Please enter the Year to be checked: ");
year=Keyboard.readInt();
while (year != 0) {
if (year%LEAP_NUM==0)
id=1;
if (year%LEAPCK1==0){
id=0;
if (year%LEAPCK2==0)
id=1;
}
if (year<GREGCK)
id=3;
if (id==1)
System.out.println("The year is a leap year");
else
if (id==0)
System.out.println("The year is not a leap year");
else
System.out.println("The Gregorian calender was not
created by that time");
System.out.print("Please enter the Year to be checked (0 to
exit): ");
year=Keyboard.readInt();
}
}
}
The cs1 class is used to given to us by the writers of the book and is
used to get input from the user.
THe cs1 code is here
http://duke.csc.villanova.edu/jss/downloads/Keyboard.java
For some reason when the code is run in netbeans it returns
Error reading int data, MIN_VALUE value returned.
which it never did in version 3.6
While I can always go back to 3.6, the newer version has sever great
features that I would like to use
Any help would be greatly appreciated