Skip to content

Commit

Permalink
Merge branch 'branch-Level-8'
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/main/java/Deadline.java
#	src/main/java/Duke.java
#	src/main/java/Event.java
  • Loading branch information
zhaojj2209 committed Aug 23, 2020
2 parents 419e04b + 3d99c23 commit 60f2e0a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 23 deletions.
14 changes: 9 additions & 5 deletions src/main/java/Deadline.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

public class Deadline extends Task {
String deadline;
private final static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMM dd yyyy");
LocalDate deadline;

public Deadline(String description, boolean isDone) {
super(description.split(" /by ")[0], isDone);
System.out.println("new deadline");
this.deadline = description.split(" /by ")[1];
super(description.split(" /by ")[0], false);
this.deadline = LocalDate.parse(description.split(" /by ")[1]);
}

@Override
public String toString() {
return "[D][" + super.getStatusIcon() + "] " + super.description + " (by: " + this.deadline + ")";
return "[D][" + super.getStatusIcon() + "] " + super.description + " (by: " + this.deadline.format(formatter) + ")";
}
}
4 changes: 2 additions & 2 deletions src/main/java/Duke.java
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,9 @@ public static void main(String[] args) {
System.out.println("How to add tasks to the list:");
System.out.println("ToDo - type 'todo' followed by the description");
System.out.println("Deadline - type 'deadline' followed by the description," +
"then '/by', then due date");
"then '/by', then due date in yyyy-MM-dd format");
System.out.println("Event - type 'event' followed by the description, " +
"then '/at', then timing");
"then '/at', then timing in yyyy-MM-dd format");
System.out.println("Type 'done' followed by the task number " +
"and I'll mark it as done");
System.out.println("Type 'list' to see the list");
Expand Down
13 changes: 9 additions & 4 deletions src/main/java/Event.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

public class Event extends Task {
String eventTime;
private final static DateTimeFormatter formatter = DateTimeFormatter.ofPattern("MMM dd yyyy");
LocalDate eventTime;

public Event(String description, boolean isDone) {
super(description.split(" /at ")[0], isDone);
this.eventTime = description.split(" /at ")[1];
super(description.split(" /at ")[0], false);
this.eventTime = LocalDate.parse(description.split(" /at ")[1]);
}

@Override
public String toString() {
return "[E][" + super.getStatusIcon() + "] " + super.description + " (at: " + this.eventTime + ")";
return "[E][" + super.getStatusIcon() + "] " + super.description + " (at: " + this.eventTime.format(formatter) + ")";
}
}
20 changes: 10 additions & 10 deletions text-ui-test/EXPECTED.TXT
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,31 @@ Hello, I'm Duke
I can help you keep track of all your tasks! ☆*:.。.o(≧▽≦)o.。.:*☆
How to add tasks to the list:
ToDo - type 'todo' followed by the description
Deadline - type 'deadline' followed by the description,then '/by', then due date
Event - type 'event' followed by the description, then '/at', then timing
Deadline - type 'deadline' followed by the description,then '/by', then due date in yyyy-MM-dd format
Event - type 'event' followed by the description, then '/at', then timing in yyyy-MM-dd format
Type 'done' followed by the task number and I'll mark it as done
Type 'list' to see the list
Type 'bye' to exit
List is empty
Added: [T][✘] borrow book
Total tasks: 1
Added: [D][✘] return book (by: Sunday)
Added: [D][✘] return book (by: Aug 25 2020)
Total tasks: 2
Added: [E][✘] project meeting (at: Mon 2-4pm)
Added: [E][✘] project meeting (at: Aug 26 2020)
Total tasks: 3
Items in list:
1. [T][✘] borrow book
2. [D][✘] return book (by: Sunday)
3. [E][✘] project meeting (at: Mon 2-4pm)
2. [D][✘] return book (by: Aug 25 2020)
3. [E][✘] project meeting (at: Aug 26 2020)
Task marked complete:
[T][✓] borrow book
Items in list:
1. [T][✓] borrow book
2. [D][✘] return book (by: Sunday)
3. [E][✘] project meeting (at: Mon 2-4pm)
2. [D][✘] return book (by: Aug 25 2020)
3. [E][✘] project meeting (at: Aug 26 2020)
Task deleted:
[T][✓] borrow book
Items in list:
1. [D][✘] return book (by: Sunday)
2. [E][✘] project meeting (at: Mon 2-4pm)
1. [D][✘] return book (by: Aug 25 2020)
2. [E][✘] project meeting (at: Aug 26 2020)
Bye! :>
4 changes: 2 additions & 2 deletions text-ui-test/input.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
list
todo borrow book
deadline return book /by Sunday
event project meeting /at Mon 2-4pm
deadline return book /by 2020-08-25
event project meeting /at 2020-08-26
list
done 1
list
Expand Down

0 comments on commit 60f2e0a

Please sign in to comment.