[Yao Chenguang] iP#182
Conversation
| System.out.print("---------------------------------------------\n"); | ||
| System.out.print(command +"\n"); | ||
| System.out.print("---------------------------------------------\n"); |
There was a problem hiding this comment.
I would suggest using System.lineSeparator() instead of "\n" for code compatibility with other systems.
| static String[] todolist = new String[MAX_LIST_LENGTH]; | ||
| static boolean[] isDoneList = new boolean[MAX_LIST_LENGTH]; |
There was a problem hiding this comment.
Good use of a static final int, instead of specifying "100" directly in the array as you have avoided using magic numbers.
| @@ -0,0 +1,62 @@ | |||
| import javax.swing.*; | |||
There was a problem hiding this comment.
Would it be better to not import all packages although according to google it is lightweight.
|
|
||
|
|
||
|
|
||
|
|
There was a problem hiding this comment.
You may want to reduce the number of line breaks.
| if(s == null){ | ||
| continue; | ||
| } | ||
| System.out.printf("%d."+GetIcon(i)+s+"\n",i); |
There was a problem hiding this comment.
You may want to add spaced before and after the "+", this is part of coding standards.
ChoonSiang
left a comment
There was a problem hiding this comment.
Good attempt at abstraction, but need to work on formatting, especially on the usage of space to follow the coding standard and allow for easier readability. Also need to consider the logic of your program whereby the rest of the commands is only accessible after the user input list.
| public class Todolist { | ||
|
|
||
| String Icon = "T"; | ||
| private static final int MAX_LIST_LENGTH = 100; |
There was a problem hiding this comment.
Good use of constant for the max list length
| static int ListCount= 0; | ||
| static Scanner in = new Scanner(System.in); | ||
|
|
||
| public static void AddToList(){ |
There was a problem hiding this comment.
| public static void AddToList(){ | |
| public static void AddToList() { |
Take note that for function declaration, there should be a space before {
| while(!command.equals("quit")){ | ||
| command = in.nextLine(); | ||
| switch (command){ | ||
| case"add": |
There was a problem hiding this comment.
Inconsistency in whether there is a space after case.
| case"add": | |
| case "add": |
|
|
||
| public static void PrintList(){ | ||
| int i=1; | ||
| System.out.print("---------------------------------------------\n"); |
There was a problem hiding this comment.
Consider making this a constant to prevent repetition of the same code and will be more consistent when modification is made
| switch (command){ | ||
| case "Bye": | ||
| System.out.print(GOODBYE_GREETING); | ||
| break; | ||
| case "list": | ||
| Todolist.HandleList(); | ||
| break; | ||
|
|
||
|
|
||
| default: | ||
| echo(command); | ||
| break; | ||
|
|
||
| } |
There was a problem hiding this comment.
Why is the other commands such as quit, help, mark, unmark etc. only accessible after the user input list?
| System.out.print("supported commands: add , quit , help , mark,unmark ,clear, list\n"); | ||
| break; | ||
| case "clear": | ||
| ClearList(); |
There was a problem hiding this comment.
Good attempt at abstracting the functionality of each command
| number= in.nextInt(); | ||
| } | ||
|
|
||
| isDoneList[number-1]=true; |
There was a problem hiding this comment.
| isDoneList[number-1]=true; | |
| isDoneList[number-1] = true; |
| } | ||
| static void ClearList(){ | ||
| int i; | ||
| for (i=0;i<MAX_LIST_LENGTH;i++){ |
There was a problem hiding this comment.
| for (i=0;i<MAX_LIST_LENGTH;i++){ | |
| for (i = 0; i < MAX_LIST_LENGTH; i++) { |
added the function of find matching todos
…tion normally , and changed time form so that the start time and end time are stored as Localdates , accept input as yyyy-MM-dd and output as MMM dd yyyy
No description provided.