To create User objects:
--for each type, I have two constructors, one with only the basics and one with all info. Feel free to just choose for now i guess :)
STUDENT:
public Student(String userName, String password, String email) {
super(userName, password, email);
super.setRole("S");
}
public Student(String userName, String firstName, String lastName, String email, String password) {
super(userName, firstName, lastName, email, password);
super.setRole("S");
}
TEACHER:
public Teacher(String userName, String firstName, String lastName, String email, String password) {
super(userName, firstName, lastName, email, password);
super.setRole("T");
}
public Teacher(String userName, String password, String email) {
super(userName, password, email);
super.setRole("T");
}
ADMIN:
public Admin(String userName, String firstName, String lastName, String email, String password) {
super(userName, firstName, lastName, email, password);
super.setRole("A");
}
public Admin(String userName, String password, String email) {
super(userName, password, email);
super.setRole("A");
}
ADDING TO DB:
//create AppDAO object
AppDAO appDAO = new AppDAO();
//pass in User object (any of the three subclasses will work)
appDAO.insertNewUser(user);
//profit!!?