-
Notifications
You must be signed in to change notification settings - Fork 187
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Yao Chenguang] iP #182
base: master
Are you sure you want to change the base?
[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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would suggest using System.lineSeparator() instead of "\n" for code compatibility with other systems.
src/main/java/Todolist.java
Outdated
static String[] todolist = new String[MAX_LIST_LENGTH]; | ||
static boolean[] isDoneList = new boolean[MAX_LIST_LENGTH]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be better to not import all packages although according to google it is lightweight.
src/main/java/Qchat.java
Outdated
|
||
|
||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to reduce the number of line breaks.
src/main/java/Todolist.java
Outdated
if(s == null){ | ||
continue; | ||
} | ||
System.out.printf("%d."+GetIcon(i)+s+"\n",i); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may want to add spaced before and after the "+", this is part of coding standards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
src/main/java/Listmanager.java
Outdated
public class Todolist { | ||
|
||
String Icon = "T"; | ||
private static final int MAX_LIST_LENGTH = 100; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good use of constant for the max list length
src/main/java/Listmanager.java
Outdated
static int ListCount= 0; | ||
static Scanner in = new Scanner(System.in); | ||
|
||
public static void AddToList(){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public static void AddToList(){ | |
public static void AddToList() { |
Take note that for function declaration, there should be a space before {
src/main/java/Listmanager.java
Outdated
while(!command.equals("quit")){ | ||
command = in.nextLine(); | ||
switch (command){ | ||
case"add": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistency in whether there is a space after case.
case"add": | |
case "add": |
src/main/java/Listmanager.java
Outdated
|
||
public static void PrintList(){ | ||
int i=1; | ||
System.out.print("---------------------------------------------\n"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider making this a constant to prevent repetition of the same code and will be more consistent when modification is made
src/main/java/Qchat.java
Outdated
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the other commands such as quit, help, mark, unmark etc. only accessible after the user input list?
src/main/java/Listmanager.java
Outdated
System.out.print("supported commands: add , quit , help , mark,unmark ,clear, list\n"); | ||
break; | ||
case "clear": | ||
ClearList(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good attempt at abstracting the functionality of each command
src/main/java/Listmanager.java
Outdated
number= in.nextInt(); | ||
} | ||
|
||
isDoneList[number-1]=true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
isDoneList[number-1]=true; | |
isDoneList[number-1] = true; |
src/main/java/Listmanager.java
Outdated
} | ||
static void ClearList(){ | ||
int i; | ||
for (i=0;i<MAX_LIST_LENGTH;i++){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.