public class Course {
    private final int MIN_NAME_LEN = 10;
    private final int MAX_NAME_LEN = 100;

    private String department;
    private String catalog_no;
    private String name;

    public Course (String department, String catalog_no, String name) 
        throws IllegalArgumentException{
            if (department_good(department) && catalog_no_good(catalog_no) &&
                 name_good(name)){
            this.department = department;
            this.catalog_no = catalog_no;
            this.name       = name;
        }   
    }

    public String toString() {
        return department + " " + catalog_no + ": " + name;
    }

    private boolean department_good(String value) throws IllegalArgumentException{
        boolean value_good = value.equals("IT");
        if (! value_good ){
            throw new IllegalArgumentException("Department must be IT");
        } else {
            return value_good;
        }
    }

    private boolean catalog_no_good(String catalog_no) throws IllegalArgumentException{
        switch (catalog_no) {
            case "114":
            case "116":
            case "117":
            case "244":
            case "246":
            case "285":
            case "341":
            case "442":
            case "443":
            case "444":
            case "485":
                return true;
            default:
                throw new IllegalArgumentException(catalog_no + " is not valid");
        }
    }

    private boolean name_good(String name){
        if (name.length() >= MIN_NAME_LEN && name.length() <= MAX_NAME_LEN) {
            return true;
        } else {
            throw new IllegalArgumentException("name must be between " + MIN_NAME_LEN +
                                                " and " + MAX_NAME_LEN + " characters long");
        }
    }

    public String department(){
        return department;
    }

    public String catalog_no(){
        return catalog_no;
    }

    public String name(){
        return name;
    }    
}