Skip to content

Duke ip update#175

Open
Ijaaz01 wants to merge 29 commits into
nus-cs2113-AY2324S2:masterfrom
Ijaaz01:master
Open

Duke ip update#175
Ijaaz01 wants to merge 29 commits into
nus-cs2113-AY2324S2:masterfrom
Ijaaz01:master

Conversation

@Ijaaz01

@Ijaaz01 Ijaaz01 commented Feb 6, 2024

Copy link
Copy Markdown
  • Add Task.java to take care of tasks in list
  • Change Duke to Pythia
  • Add mood sprites for Pythia

@YHWong20 YHWong20 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.

Remember to add spaces between your operators:
https://se-education.org/guides/conventions/java/index.html#layout

Comment thread src/main/java/Duke.java Outdated
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Duke {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Insert a line break after your import statements.

Comment thread src/main/java/Duke.java Outdated
System.out.println((i+1)+"."+list.get(i).getDoneStatus()+" "+list.get(i).getDescription());
}
}
public static void main(String[] args) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Insert a line break between methods.

Comment thread src/main/java/Duke.java Outdated
public class Duke {
public static void printList(List<Task> list) {
for (int i = 0; i < list.size(); i++) {
System.out.println((i+1)+"."+list.get(i).getDoneStatus()+" "+list.get(i).getDescription());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Insert spaces between your operators (in this case, insert spaces between your + to separate your operands).

Comment thread src/main/java/Duke.java Outdated
+ "| |_| | |_| | < __/\n"
+ "|____/ \\__,_|_|\\_\\___|\n";
System.out.println("Hello from\n" + logo);
String lineBreak = "----------------------------------------------------------";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Your lineBreak, idle and happy Strings should be set as constants. Declare them private final.

Comment thread src/main/java/Duke.java Outdated
String input = "Start";
List<Task> list = new ArrayList<>(2);
Scanner in = new Scanner(System.in);
System.out.println(idle + "Hello, Im Pythia, how may I help you today?\n"+lineBreak);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Add spaces between your + operator.

Comment thread src/main/java/Duke.java Outdated
List<Task> list = new ArrayList<>(2);
Scanner in = new Scanner(System.in);
System.out.println(idle + "Hello, Im Pythia, how may I help you today?\n"+lineBreak);
while (!input.equals("bye")) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Add a line break before your while loop.

Comment thread src/main/java/Duke.java Outdated
System.out.println(idle + "Hello, Im Pythia, how may I help you today?\n"+lineBreak);
while (!input.equals("bye")) {
input = in.nextLine();
if (input.equalsIgnoreCase("list")) {

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 are not following the K&R brace style for your if-else blocks.

Comment thread src/main/java/Task.java
isDone = false;
}

public void doneIsFalse() {

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 renaming your setter methods. Perhaps you could change it to setDoneAsTrue() or something?

@HengShuHong HengShuHong 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 job so far keep it up!

Comment thread src/main/java/Duke.java Outdated
else if (input.contains("unmark ")) {
String[] splitInput = input.split(" ");
list.get(Integer.parseInt(splitInput[1])-1).doneIsFalse();
System.out.println("Unmarked "+ Integer.parseInt(splitInput[1]));

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Add a space before + operator

Comment thread src/main/java/Duke.java Outdated
if (input.equalsIgnoreCase("list")) {
printList(list);
}
else if (input.contains("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.

regarding the else if statement, the coding standard should be something like this
if (....) {
xxx;
} else if {
yyyy;
} else {
zzzz;
}

Comment thread src/main/java/Duke.java Outdated
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Duke {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

not compulsory but would be good if you can rename the class according to the name of your chatbot

Comment thread src/main/java/Task.java
public String getDescription() {
return description;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

additional line here that can be removed

@aditichadha1310 aditichadha1310 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.

Overall, Good job!

@@ -0,0 +1,14 @@
public class Deadline extends Task {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comments are missing. Good to have them for better readability.

Comment thread src/main/java/Duke.java Outdated
Comment on lines +5 to +8
private static MoodSprite mood = new MoodSprite();
private static List<Task> list = new ArrayList<>(2);
private static Parser parser = new Parser();
private static final String lineBreak = "----------------------------------------------------------";

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 work with the usage of Access Modifiers.

Comment thread src/main/java/Event.java
super(description);
this.from = from.replaceFirst("from", "from:");
this.to = to.replaceFirst("to", "to:");
this.taskId = "[E]";

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Avoid the usage of Magic literals.

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.

4 participants