-
Notifications
You must be signed in to change notification settings - Fork 78
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
[janelleenqi] iP #75
base: master
Are you sure you want to change the base?
[janelleenqi] iP #75
Conversation
src/main/java/Duke.java
Outdated
System.out.println("Hello! I'm\n" + logo); | ||
System.out.println("What can I do for you?"); | ||
|
||
Task[] theList = new Task[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.
Consider using a more descriptive name such as taskList
instead of theList
src/main/java/Duke.java
Outdated
|
||
String echo = userInput.nextLine(); | ||
|
||
while (!echo.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.
Consider declaring static final constants for each command (e.g. bye, list, mark) so that they can be easily referenced and updated for future use
while (!echo.equals("bye")) { | |
private static final String BYE_COMMAND = "bye"; | |
while (!echo.equals("bye")) { |
src/main/java/Task.java
Outdated
@@ -0,0 +1,27 @@ | |||
public class 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.
Good job for using good coding standards in this file! Descriptive names are used for functions and variables
src/main/java/Duke.java
Outdated
Scanner userInput = new Scanner(System.in); | ||
int counter = 0; | ||
|
||
String echo = userInput.nextLine(); |
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.
Can consider making some changes to the following variables:
echo
should be renamed touserInputString
instead since your default command is now adding a new taskuserInput
should contain the scanner keyword such asinputScanner
to better signify that it is the scanner object
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.
Clear code and good use of white space to make the code clean and easy to read. Good job!
src/main/java/Duke.java
Outdated
while (!echo.equals("bye")) { | ||
String[] words = echo.split(" "); //to identify usage of features "mark" & "unmark" | ||
|
||
if (echo.equals("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.
Could potentially use a switch if possible to make the code more readable.
src/main/java/Duke.java
Outdated
|
||
Task[] theList = new Task[100]; | ||
Scanner userInput = new Scanner(System.in); | ||
int counter = 0; |
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.
Perhaps the counter variable could be more descriptive to allow the reader to understand what it is counting.
src/main/java/Task.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.
I like your use of descriptive names to make the code clear and concise.
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 for your ip so far. Take note of how you name your variables, using clear and appropriate names can improve the readability of your code. Keep up the good work!
src/main/java/Duke.java
Outdated
Scanner userInput = new Scanner(System.in); | ||
int counter = 0; | ||
|
||
String echo = userInput.nextLine(); |
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 using a more suitable name for echo so that it is more descriptive for the reader.
src/main/java/Duke.java
Outdated
switch (action) { | ||
case 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.
There is a violation of Java coding standard here. There should be no indentation for case clauses. Please configure your IDE to follow the coding standard.
src/main/java/Duke.java
Outdated
|
||
case DEADLINE: | ||
taskDescription = echo.substring(8); | ||
slashCut = taskDescription.indexOf("/"); |
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 this variable to make it more descriptive.
…at ExitCommand can be called
Add JavaDoc Comments
…" are created if they do not exist
pull request 1