public static void main(String[] args) throws IOException
{
byte[] option = new byte[100];
ArrayList<Task> TaskList = new ArrayList<Task>();
for(;;){ //nihao
ObjectInputStream ois = null;
try{
ois = new ObjectInputStream(new FileInputStream("timetracker.data"));
TaskList = (ArrayList<Task>)ois.readObject();
} catch (ClassNotFoundException e){
System.out.println("(None)");
} catch (EOFException e){ // catch EOF
System.out.println("have reached the end of file");
}
finally{
if( ois != null )
{
ois.close();
}
int n = TaskList.size();
System.out.println(n);
}
ManuPrint manu = new ManuPrint();
manu.Print();
int numRead = System.in.read(option);
if((char) option[0] == '1'||(char) option[0] == '2'||(char) option[0] == '3'||(char) option[0] == '4'||(char) option[0] == '5'){
if((char) option[0] == '1'){
System.out.println("Enter new task (blank line ends input, no text ends the current task):");
Date date = new Date();
SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat dt = new SimpleDateFormat("HH:mm");
//------------------------------record the last finished task
//------------------------------record the last finished task
// still not sloved multi lines
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str = null;
str=br.readLine();
// multi lines
Task a = new Task((ft.format(date)),(dt.format(date)),"","",str);
TaskList.add(a);
} // option 1
if((char) option[0] == '5'){
FileOutputStream fout = new FileOutputStream("timetracker.data");
ObjectOutputStream out = new ObjectOutputStream(fout);
try{
public static void main(String[] args) throws IOException
{
byte[] option = new byte[100];
ArrayList<Task> TaskList = new ArrayList<Task>();
for(;;){ //nihao
ObjectInputStream ois = null;
try{
ois = new ObjectInputStream(new FileInputStream("timetracker.data"));
TaskList = (ArrayList<Task>)ois.readObject();
} catch (ClassNotFoundException e){
System.out.println("(None)");
} catch (EOFException e){ // catch EOF
System.out.println("have reached the end of file");
}
finally{
if( ois != null )
{
ois.close();
}
int n = TaskList.size();
System.out.println(n);
}
ManuPrint manu = new ManuPrint();
manu.Print();
int numRead = System.in.read(option);
if((char) option[0] == '1'||(char) option[0] == '2'||(char) option[0] == '3'||(char) option[0] == '4'||(char) option[0] == '5'){
if((char) option[0] == '1'){
System.out.println("Enter new task (blank line ends input, no text ends the current task):");
Date date = new Date();
SimpleDateFormat ft = new SimpleDateFormat("yyyy-MM-dd");
SimpleDateFormat dt = new SimpleDateFormat("HH:mm");
//------------------------------record the last finished task
//------------------------------record the last finished task
// still not sloved multi lines
BufferedReader br = new BufferedReader(new InputStreamReader(System.in));
String str = null;
str=br.readLine();
// multi lines
Task a = new Task((ft.format(date)),(dt.format(date)),"","",str);
TaskList.add(a);
} // option 1
if((char) option[0] == '5'){
FileOutputStream fout = new FileOutputStream("timetracker.data");
ObjectOutputStream out = new ObjectOutputStream(fout);
try{