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

[Wang-Jingwei] iP #102

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

Conversation

Wang-Jingwei
Copy link

No description provided.

Wang-Jingwei and others added 30 commits February 13, 2022 23:39
* branch-Level-5:
  Add some error handlings.
* branch-Level-6:
  Add the delete functionality.
* branch-Level-7:
  Add the functionality to load data from the file and save data into the file.
* master:
  Add the find functionality.
Copy link

@Mick609 Mick609 left a comment

Choose a reason for hiding this comment

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

Readable code with some coding standard and naming convention issue.

public void run() throws IOException {
String task;
ui.greetings();
Scanner in = new Scanner(System.in);
Copy link

Choose a reason for hiding this comment

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

Maybe you should consider a more descriptive name for the Scanner object like "scanner"?

String task;
ui.greetings();
Scanner in = new Scanner(System.in);
task=in.nextLine();
Copy link

Choose a reason for hiding this comment

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

Please make sure the spaces between operators are consistent.

else{
try{
int index = Integer.parseInt(words[1]);
if(index>todolist.size()||index<=0) System.out.println("No task found.");
Copy link

Choose a reason for hiding this comment

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

Maybe you should consider having the if block in two lines.

break;
}
case "find": {
if (words.length == 1) ui.incompleteMessage("find");
Copy link

Choose a reason for hiding this comment

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

Maybe you could place the if and else blocks in more than a line.

*/

public static void save(String textToAdd,String filePath) throws IOException {
FileWriter fw = new FileWriter(filePath,false);
Copy link

Choose a reason for hiding this comment

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

Maybe you should consider a more descriptive name for the object like fileWriter.

*/
public ArrayList<Task> load() throws IOException {
ArrayList<Task> todolist = new ArrayList<Task>();
BufferedReader br = new BufferedReader(new FileReader(this.filePath));
Copy link

Choose a reason for hiding this comment

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

Name like "bufferedReader" would be better in this case.

* @param deadline Description of the task which will be added as Deadline.
*/
public void addDeadline(ArrayList<Task> taskList, String deadline){
String[] deadline1 = deadline.split("/by", 2);
Copy link

Choose a reason for hiding this comment

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

Maybe you should use the plural form for the name of a String array.

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.

2 participants