[Wang Huilin]ip#75
Conversation
| public class Chatbox { | ||
| private String content = ""; | ||
| private final String horizontalLine = "-------------------------------------"; | ||
|
|
||
| public void chatboxPrinter(){ | ||
| System.out.println(content); | ||
| System.out.println(horizontalLine); | ||
| } | ||
|
|
||
| public void linePrinter(){ | ||
| System.out.println(horizontalLine); | ||
| } | ||
|
|
||
| public void setContent(String input){ | ||
| this.content = input; | ||
| } | ||
|
|
||
|
|
||
| } |
There was a problem hiding this comment.
This class could be combined with controller.
emilysim00
left a comment
There was a problem hiding this comment.
Your code is very well written and neat!
| chatbox.chatboxPrinter(); | ||
| } | ||
|
|
||
| public void listen() { |
There was a problem hiding this comment.
the method name can be more descriptive such as listenForInput so it can be better understandable.
| Controller bot = new Controller(); | ||
| bot.greet(); | ||
| while(true){ | ||
| bot.listen(); | ||
| } |
There was a problem hiding this comment.
I like the idea of having the controller.java in a separate file and not a whole chunk of code in the main program! Very Nice!
| public class TaskManager { | ||
| private static final ArrayList<Task> Tasks = new ArrayList<Task>(); |
There was a problem hiding this comment.
The use of ArrayList object is good! This helps to eliminate problem such as magic numbers or the problem of worrying the size of the list
| Deadline newDeadline = new Deadline(name, by); | ||
| Tasks.add(newDeadline); | ||
| int s = Tasks.size(); | ||
| String response = addResponse + newDeadline.getListName() + "\n" + "Now you have " + String.valueOf(s) + " tasks in your list."; |
There was a problem hiding this comment.
Use line-wrapping if appropriate as line length should not be more than 120 characters. The recommended line length is 110 characters.
eigne
left a comment
There was a problem hiding this comment.
With more documentation and some changes it should be good to merge.
| import java.util.Scanner; | ||
|
|
||
| public class Controller { | ||
| public String hello = "Hello! I'm Duke :P\nWhat can I do for you?"; |
There was a problem hiding this comment.
Will these Strings change as the program runs? If not, consider making them final and changing the variable names to uppercase.
| this.recvMsg = msg.nextLine(); | ||
| String[] keyword = this.recvMsg.toLowerCase(Locale.ROOT).split(" "); | ||
| switch (keyword[0]) { | ||
| case "bye": |
There was a problem hiding this comment.
Consider replacing these string literals with final variables in uppercase.
| public void setListName(){ | ||
| if(isDone == false){ | ||
| this.listName = this.unmarkedStatus + this.taskName; | ||
| }else{ |
There was a problem hiding this comment.
Consider adding a space before "else" to improve readability.
| chatbox.chatboxPrinter(); | ||
| } | ||
|
|
||
| public void addDeadline(String name, String by){ |
There was a problem hiding this comment.
Consider adding documentation to non-trivial functions.
| content = "Sorry, there's no task in the list :("; | ||
| }else { | ||
| for (int i = 0; i < Tasks.size(); i++) { | ||
| String index = String.valueOf(i + 1); | ||
| String name = index + ". " + Tasks.get(i).getListName(); | ||
| content += name; | ||
| if(i < Tasks.size() - 1){ | ||
| content += "\n"; | ||
| } | ||
| } | ||
| } |
There was a problem hiding this comment.
This looks like arrowhead code. Consider moving some of this code into another method to follow SLAP
| this.addTask(this.recvMsg); | ||
| } | ||
| } | ||
|
|
|
Thank you very much for your suggestions @matheril , @emilysim00 and @Ch40gRv1-Mu ! I'll add them on and improve the code in later commits. :D |
branch-level-5
Branch level 6
Add Date and Time
Add Javadoc
No description provided.