Google

Monday, May 26, 2008

Inticas 008: Removed XML Added Teacher Class

In Inticas 008, removed all xml code, since it is not necessary to save data in xml format.
Instead both objects Classroom and Teacher which implements Serializable is saved in files as Objects.

Saving as Objects has the advantage that the entire object including data information is saved as well.

I also added the Teacher Class:

package inticas;
import java.io.Serializable;

public class Teacher implements Serializable
{
private String name;
private String initials;
private boolean needBreak = false;
private int taughtToday;
private int maxTotal;
private String subjects[] = new String[10];

public void setName(String s) {
name = s;
}
public void setInitials(String s) {
initials = s;
}
public void toggleBreak() {
needBreak = !needBreak;
}
public void incrementTaughtToday() {
taughtToday++;
}
public void setmaxTotal(int i) {
maxTotal = i;
}

////////////////////////////////////
public String getName(){
return name;
}
public String getInitials(){
return initials;
}
public int getmaxTotal(){
return maxTotal;
}


}


Only a few attributes and methods at this point.
Will gradually add more.

Also added a Add Teacher Frame which hardcodes one teacher object and saves as file:
TeacherSerialized.txt