public Person getPerson(int personid) throws Exception {
        // for getting any person out of the database
        DBConnector db = new DBConnector();
        ResultSet rs = db.getPerson(personid);
        if(rs.next()) {
            if(rs.getString("persontype").equals("student")) {
                return new Student(rs);
            }
            else if(rs.getString("persontype").equals("teacher")) {
                return new Teacher(rs);
            }
            else {
                throw new Exception("invalid persontype from database");
            }
        }
        else {
            throw new Exception("record not found");
        }
    }