code:To declare a constructor you declare a public method with no return type who's name is the name of the class. For example:public class Date {
/* Your constructors go here. */
/* Your accessors go here. */
/* Your private variables go here. */
}
code:To declare a public method the basic syntax goes like this:public Date() {
/* Do something in here... */
}
code:For example:public <return type> <method name>(<parameters) {
/* Do something in here... */
}
code:The basic syntax to declare a private variable goes along these lines:public int getMyInt() {
return MyInt;
}
code:And honestly what I've just told you pretty much solves the whole problem for you (which makes me want to growl at your professor, cause that's a really lame assignment).private int MyInt;
code:switch (roomNum){
case 1:
case 2:
case 5:
if (!hasBlueLevelAccess(person){
throw new Exception("Access Denied");
}
case 3:
case 4:
if (!isBearingCookies(person){
throw new Exception("Eat them");
}
default:
throw new Exception("No Such Room. Killer robots dispatched.");
}