Skip to content

[Yao Chenguang] iP#182

Open
classskipper351 wants to merge 19 commits into
nus-cs2113-AY2324S2:masterfrom
classskipper351:master
Open

[Yao Chenguang] iP#182
classskipper351 wants to merge 19 commits into
nus-cs2113-AY2324S2:masterfrom
classskipper351:master

Conversation

@classskipper351

Copy link
Copy Markdown

No description provided.

Comment thread src/main/java/Qchat.java
Comment on lines +45 to +47
System.out.print("---------------------------------------------\n");
System.out.print(command +"\n");
System.out.print("---------------------------------------------\n");

Copy link
Copy Markdown

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.

Comment thread src/main/java/Todolist.java Outdated
Comment on lines +5 to +6
static String[] todolist = new String[MAX_LIST_LENGTH];
static boolean[] isDoneList = new boolean[MAX_LIST_LENGTH];

Copy link
Copy Markdown

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.

Comment thread src/main/java/Qchat.java
@@ -0,0 +1,62 @@
import javax.swing.*;

Copy link
Copy Markdown

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.

Comment thread src/main/java/Qchat.java Outdated
Comment on lines +14 to +17




Copy link
Copy Markdown

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.

Comment thread src/main/java/Todolist.java Outdated
if(s == null){
continue;
}
System.out.printf("%d."+GetIcon(i)+s+"\n",i);

Copy link
Copy Markdown

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.

@ChoonSiang ChoonSiang left a comment

Copy link
Copy Markdown

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.

Comment thread src/main/java/Listmanager.java Outdated
public class Todolist {

String Icon = "T";
private static final int MAX_LIST_LENGTH = 100;

Copy link
Copy Markdown

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

Comment thread src/main/java/Listmanager.java Outdated
static int ListCount= 0;
static Scanner in = new Scanner(System.in);

public static void AddToList(){

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public static void AddToList(){
public static void AddToList() {

Take note that for function declaration, there should be a space before {

Comment thread src/main/java/Listmanager.java Outdated
while(!command.equals("quit")){
command = in.nextLine();
switch (command){
case"add":

Copy link
Copy Markdown

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.

Suggested change
case"add":
case "add":

Comment thread src/main/java/Listmanager.java Outdated

public static void PrintList(){
int i=1;
System.out.print("---------------------------------------------\n");

Copy link
Copy Markdown

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

Comment thread src/main/java/Qchat.java
Comment on lines +24 to +37
switch (command){
case "Bye":
System.out.print(GOODBYE_GREETING);
break;
case "list":
Todolist.HandleList();
break;


default:
echo(command);
break;

}

Copy link
Copy Markdown

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?

Comment thread src/main/java/Listmanager.java Outdated
System.out.print("supported commands: add , quit , help , mark,unmark ,clear, list\n");
break;
case "clear":
ClearList();

Copy link
Copy Markdown

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

Comment thread src/main/java/Listmanager.java Outdated
number= in.nextInt();
}

isDoneList[number-1]=true;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
isDoneList[number-1]=true;
isDoneList[number-1] = true;

Comment thread src/main/java/Listmanager.java Outdated
}
static void ClearList(){
int i;
for (i=0;i<MAX_LIST_LENGTH;i++){

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
for (i=0;i<MAX_LIST_LENGTH;i++){
for (i = 0; i < MAX_LIST_LENGTH; i++) {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants