Z
zcraven
public void setPlayerHeight(int height_in_cms) throws
IllegalArgumentException
{
Integer dwarf = new Integer(70);
Integer giant = new Integer(270);
Integer zero = new Integer(0);
/* if ((Integer (height_in_cms).intValue)=0){
throw new IllegalStateException("height cannot be blank.");
} */
if (height_in_cms == zero.intValue()){
throw new IllegalStateException("height cannot be a negative
number.");
}
if (height_in_cms <= dwarf.intValue()){
throw new IllegalArgumentException("height cannot be less than
70cms");
}
if (height_in_cms >= giant.intValue()){
throw new IllegalArgumentException("height cannot be above 270cms");
}
playerHeight = height_in_cms;
}
Why doesn't this throw an error when I enter the height as too tall/short
etc? Weird...
IllegalArgumentException
{
Integer dwarf = new Integer(70);
Integer giant = new Integer(270);
Integer zero = new Integer(0);
/* if ((Integer (height_in_cms).intValue)=0){
throw new IllegalStateException("height cannot be blank.");
} */
if (height_in_cms == zero.intValue()){
throw new IllegalStateException("height cannot be a negative
number.");
}
if (height_in_cms <= dwarf.intValue()){
throw new IllegalArgumentException("height cannot be less than
70cms");
}
if (height_in_cms >= giant.intValue()){
throw new IllegalArgumentException("height cannot be above 270cms");
}
playerHeight = height_in_cms;
}
Why doesn't this throw an error when I enter the height as too tall/short
etc? Weird...