in the main
else if(user ==3) {
todolists.Displayitem();
duedatelists.Displayitem();
prilists.Displayitem();
System.out.println("");
}
in the class Todo
public void Displayitem() {
if(todolist.size()==0) {
System.out.println("All Done !!!");
}else {
System.out.println("To Do List");
int index =1;
for(String item: todolist) {
System.out.print("(" index ")" item " ");
}
}
}
I think it would print something like (1) test 1 DATE mmddyy LEVEL (2) test 2 DATE mmddyy LEVEL
but it prints (1) test1 (2) test2 DATE DATE LEVEL LEVEL
CodePudding user response:
You need to remove the following lines from main and put them in DisplayItem
duedatelists.Displayitem();
prilists.Displayitem();
System.out.println("");
CodePudding user response:
It seems you have three lists to print:
todolists.Displayitem();
duedatelists.Displayitem();
prilists.Displayitem();
However you want information from all three lists printed together. So how about assuming that you have an equal number of entries in all three lists, then you can do
for (int i=0;i<todolists.size()) {
System.out.print(i);
System.out.print(todolists.get[i]);
System.out.print(duedatelists.get[i]);
System.out.print(prilists.get[i]);
}
You will have to add whitespace/formatting to your taste to make it readable though.
