Skip to content
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8bf8991
add increment level 0
silinche Aug 20, 2021
5876d3a
added increment 1
silinche Aug 25, 2021
02672d8
added increment 2
silinche Aug 25, 2021
d75ba2c
added increment 3
silinche Aug 25, 2021
c77d04f
fix minor bug for increment 3
silinche Aug 25, 2021
308eacf
update on A-CodingStandard
silinche Aug 25, 2021
97a6781
Increment 4
silinche Sep 1, 2021
64e85b9
fixed bugs for level-4
silinche Sep 1, 2021
48ce882
fixed minor bugs for increment level 4
silinche Sep 1, 2021
653a21d
commit text ui testing
silinche Sep 8, 2021
7f61f2d
create more functions to comply with code quality standards
silinche Sep 15, 2021
dfcf04b
added dealing with errors
silinche Sep 15, 2021
ccd2556
Merge branch 'branch-Level-5'
silinche Sep 15, 2021
b4c1c68
added packaging
silinche Sep 15, 2021
7f4ad3f
added level 6 deletion function
silinche Sep 16, 2021
06d40a3
added the save to file feature
silinche Sep 17, 2021
d308886
Merge branch 'branch-Level-6'
silinche Sep 17, 2021
2c8103d
Merge branch 'branch-Level-7'
silinche Sep 17, 2021
2a89619
created Storage class to achieve more oop
silinche Sep 28, 2021
d41de47
added ui class to achieve more oop
silinche Sep 28, 2021
3e52e94
added more classes to achieve more oop
silinche Sep 28, 2021
8320297
added the find feature (level 9)
silinche Sep 29, 2021
fd35808
added javadoc
silinche Oct 1, 2021
c492a3b
Merge pull request #1 from silinche/branch-Level-9
silinche Oct 1, 2021
e61603d
Merge branch 'master' into branch-A-JavaDoc
silinche Oct 1, 2021
1e115d9
Merge pull request #2 from silinche/branch-A-JavaDoc
silinche Oct 1, 2021
2faad66
Merge branch 'master' of https://github.com/silinche/ip
silinche Oct 1, 2021
bb57228
Added user guide
silinche Oct 1, 2021
ebba67b
Set theme jekyll-theme-cayman
silinche Oct 1, 2021
999995d
fixed issues with saving in files
silinche Oct 1, 2021
4168e98
Merge branch 'master' of https://github.com/silinche/ip
silinche Oct 1, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/main/java/Deadline.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
public class Deadline extends Task {

protected String by;

public Deadline(String description, String by) {
super(description);
this.by = by;
}

@Override
public String toString() {
return "[D]" + super.toString() + "(by: " + by + ")";
}
}

Choose a reason for hiding this comment

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

Clear! Reader would not be confused.

95 changes: 89 additions & 6 deletions src/main/java/Duke.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,93 @@
import java.util.Scanner;


public class Duke {
public static void hi() {
Copy link

Choose a reason for hiding this comment

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

The name of the method have to be a verb instead:
https://se-education.org/guides/conventions/java/basic.html#naming

System.out.println("Hello I'm Duke");
System.out.println("What can I do for you?");
}

public static void bye() {
Copy link

Choose a reason for hiding this comment

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

The name of the method have to be a verb instead:
https://se-education.org/guides/conventions/java/basic.html#naming

System.out.println("Bye. Hope to see you again soon!");
}

public static void running() {
Copy link

Choose a reason for hiding this comment

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

The name of the method have to be a verb instead:
https://se-education.org/guides/conventions/java/basic.html#naming

Task[] tasks= new Task[100];
int taskNumber = 0;
String line;
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.

Perhaps you can name the in here inputScanner instead?

while (true) {
//new scanner
line = in.nextLine();
//if goodbye
if (line.equals("bye")) {
return;
}
//if want to list out tasks or mark as done or add items
if (line.equals("list")) {
for (int i = 0; i < taskNumber; i++) {
System.out.println((i + 1) + "." + tasks[i]);
}
Copy link

Choose a reason for hiding this comment

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

Good work on following bracketing conventions:
https://se-education.org/guides/conventions/java/basic.html#conditionals

} else if (line.startsWith("done")) {
int index = Integer.parseInt(line.substring(5)) - 1;
tasks[index].setDone();
System.out.println("Nice! I've marked this task as done:");
System.out.println(" " + tasks[index].getStatusIcon() + " " + tasks[index].getDescription());
} else if (line.startsWith("todo")) {
tasks[taskNumber] = new ToDo(line.substring(5));
taskNumber++;
System.out.println("Got it. I've added this task:");
System.out.println(" " + tasks[taskNumber - 1]);
System.out.println("Now you have " + taskNumber + " tasks in the list");
} else if (line.startsWith("deadline")) {
String[] words = line.split(" ");
int index = 0;
String deadlineDescription = "";
String by = "";
for (int i = 0; i < words.length; i++) {
if (words[i].equals("/by")) {
index = i;
break;
}
}
for (int i = 1; i < index; i++) {
deadlineDescription = deadlineDescription + words[i] + " ";
}
by = words[index + 1];
tasks[taskNumber] = new Deadline(deadlineDescription, by);
taskNumber++;
System.out.println("Got it. I've added this task:");
System.out.println(" " + tasks[taskNumber - 1]);
System.out.println("Now you have " + taskNumber + " tasks in the list");
} else if (line.startsWith("event")) {
String[] words = line.split(" ");
int index = 0;
String eventDescription = "";
String at = "";
for (int i = 0; i < words.length; i++) {
if (words[i].equals("/at")) {
index = i;
break;
}
}
for (int i = 1; i < index; i++) {
eventDescription = eventDescription + words[i] + " ";
}
for (int i = index + 1; i < words.length; i++) {
at = at + words[i] + " ";
}
tasks[taskNumber] = new Event(eventDescription, at);
taskNumber++;
System.out.println("Got it. I've added this task:");
System.out.println(" " + tasks[taskNumber - 1]);
System.out.println("Now you have " + taskNumber + " tasks in the list");
}

Choose a reason for hiding this comment

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

Good work on avoiding deep nested conditionals!

}
}

Choose a reason for hiding this comment

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

Method is over 30 lines of code. It would not fit into the computer screen making it hard to debug and read. Maybe split the method into smaller methods.


public static void main(String[] args) {
String logo = " ____ _ \n"
+ "| _ \\ _ _| | _____ \n"
+ "| | | | | | | |/ / _ \\\n"
+ "| |_| | |_| | < __/\n"
+ "|____/ \\__,_|_|\\_\\___|\n";
System.out.println("Hello from\n" + logo);
hi();
running();
bye();
}
}
14 changes: 14 additions & 0 deletions src/main/java/Event.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
public class Event extends Task {

protected String at;

public Event(String description, String at) {
super(description);
this.at = at;
}

@Override
public String toString() {
return "[E]" + super.toString() + "(at: " + at + ")";
}
}
26 changes: 26 additions & 0 deletions src/main/java/Task.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
public class Task {
protected String description;
protected boolean isDone;

public Task(String description) {
this.description = description;
this.isDone = false;
}

public void setDone() {
this.isDone = true;
}
Copy link

Choose a reason for hiding this comment

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

Good job following naming conventions, however, I think you may have to place a parameter for the boolean instead.


public String getDescription() {
return this.description;
}

public String getStatusIcon() {
return (isDone ? "[X]" : "[ ]"); // mark done task with X
}

@Override
public String toString() {
return this.getStatusIcon() + " " + this.getDescription();
}
}

Choose a reason for hiding this comment

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

Clear! Reader would not be confused.

10 changes: 10 additions & 0 deletions src/main/java/ToDo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
public class ToDo extends Task{
public ToDo(String description) {
super(description);
}

@Override
public String toString() {
return "[T]" + super.toString();
}
}

Choose a reason for hiding this comment

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

Clear! Reader would not be confused.