Skip to content
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

Duke ip update #175

Open
wants to merge 29 commits into
base: master
Choose a base branch
from
Open

Duke ip update #175

wants to merge 29 commits into from

Conversation

Ijaaz01
Copy link

@Ijaaz01 Ijaaz01 commented Feb 6, 2024

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

Copy link

@YHWong20 YHWong20 left a comment

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

@@ -1,10 +1,61 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Duke {
Copy link

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.

for (int i = 0; i < list.size(); i++) {
System.out.println((i+1)+"."+list.get(i).getDoneStatus()+" "+list.get(i).getDescription());
}
}
public static void main(String[] args) {
Copy link

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.

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

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).

+ "| |_| | |_| | < __/\n"
+ "|____/ \\__,_|_|\\_\\___|\n";
System.out.println("Hello from\n" + logo);
String lineBreak = "----------------------------------------------------------";
Copy link

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.

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

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.

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

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.

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

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.

isDone = false;
}

public void doneIsFalse() {
Copy link

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?

Copy link

@HengShuHong HengShuHong left a comment

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!

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]));

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

if (input.equalsIgnoreCase("list")) {
printList(list);
}
else if (input.contains("add ")) {

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;
}

@@ -1,10 +1,61 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
public class Duke {

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

public String getDescription() {
return description;
}

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

Copy link

@aditichadha1310 aditichadha1310 left a comment

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 {

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 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 = "----------------------------------------------------------";

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.

super(description);
this.from = from.replaceFirst("from", "from:");
this.to = to.replaceFirst("to", "to:");
this.taskId = "[E]";

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