-
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
Duke ip update #175
base: master
Are you sure you want to change the base?
Duke ip update #175
Conversation
Ijaaz01
commented
Feb 6, 2024
- Add Task.java to take care of tasks in list
- Change Duke to Pythia
- Add mood sprites for Pythia
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.
Remember to add spaces between your operators:
https://se-education.org/guides/conventions/java/index.html#layout
src/main/java/Duke.java
Outdated
@@ -1,10 +1,61 @@ | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Scanner; | |||
public class Duke { |
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.
Insert a line break after your import statements.
src/main/java/Duke.java
Outdated
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) { |
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.
Insert a line break between methods.
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()); |
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.
Insert spaces between your operators (in this case, insert spaces between your + to separate your operands).
src/main/java/Duke.java
Outdated
+ "| |_| | |_| | < __/\n" | ||
+ "|____/ \\__,_|_|\\_\\___|\n"; | ||
System.out.println("Hello from\n" + logo); | ||
String lineBreak = "----------------------------------------------------------"; |
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.
Your lineBreak
, idle
and happy
Strings should be set as constants. Declare them private final
.
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); |
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.
Add spaces between your + operator.
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")) { |
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.
Add a line break before your while loop.
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")) { |
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 are not following the K&R brace style for your if-else blocks.
src/main/java/Task.java
Outdated
isDone = false; | ||
} | ||
|
||
public void doneIsFalse() { |
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 renaming your setter methods. Perhaps you could change it to setDoneAsTrue()
or something?
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 job so far keep it up!
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])); |
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.
Add a space before + operator
src/main/java/Duke.java
Outdated
if (input.equalsIgnoreCase("list")) { | ||
printList(list); | ||
} | ||
else if (input.contains("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.
regarding the else if statement, the coding standard should be something like this
if (....) {
xxx;
} else if {
yyyy;
} else {
zzzz;
}
src/main/java/Duke.java
Outdated
@@ -1,10 +1,61 @@ | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import java.util.Scanner; | |||
public class Duke { |
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.
not compulsory but would be good if you can rename the class according to the name of your chatbot
src/main/java/Task.java
Outdated
public String getDescription() { | ||
return description; | ||
} | ||
|
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.
additional line here that can be removed
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.
Overall, Good job!
src/main/java/Deadline.java
Outdated
@@ -0,0 +1,14 @@ | |||
public class Deadline extends Task { |
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.
Comments are missing. Good to have them for better readability.
src/main/java/Duke.java
Outdated
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 = "----------------------------------------------------------"; |
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 work with the usage of Access Modifiers.
src/main/java/Event.java
Outdated
super(description); | ||
this.from = from.replaceFirst("from", "from:"); | ||
this.to = to.replaceFirst("to", "to:"); | ||
this.taskId = "[E]"; |
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.
Avoid the usage of Magic literals.
Add find functionality
Add JavaDoc for UI, Parser and Command classes