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

[Joshua Chiang] iP #374

Open
wants to merge 147 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
556af3f
Add Gradle support
May 24, 2020
013bad8
git tag Level-1
ChickenChiang Jan 19, 2023
ad0950e
Greet, Echo, Exit
ChickenChiang Jan 19, 2023
de5b7bb
Add, List
ChickenChiang Jan 19, 2023
bfa99a9
Merge remote-tracking branch 'origin/master'
ChickenChiang Jan 19, 2023
29d0e64
Update .gitignore
ChickenChiang Jan 19, 2023
1220c06
Now you can mark tasks as done and change them back to not done
ChickenChiang Jan 25, 2023
da609ba
Merge branch 'master' of https://github.com/ChickenChiang/ip
ChickenChiang Jan 26, 2023
07c5ecc
Added the following types of tasks: 1. Todos, which only have descrip…
ChickenChiang Jan 27, 2023
4e293ce
A-TextUiTesting
ChickenChiang Jan 31, 2023
6290dbd
A-Exceptions
ChickenChiang Jan 31, 2023
9392222
Level-6 Delete and A-Collections
ChickenChiang Jan 31, 2023
7a3dd94
Made Task class abstract and implemented makeSaveFormat() function
ChickenChiang Feb 7, 2023
e4ce66a
Added save functionality
ChickenChiang Feb 7, 2023
be7a1ad
Level-7. Save
ChickenChiang Feb 7, 2023
58a0861
Level-8. Added functionality for deadlines to understand date and tim…
ChickenChiang Feb 8, 2023
26059d0
Merge remote-tracking branch 'upstream/add-gradle-support'
ChickenChiang Feb 8, 2023
d1feb10
Using Gradle to automate building and testing for Cluck
ChickenChiang Feb 8, 2023
452abdb
Changes to checkstyle and addition of JUnit test classes
ChickenChiang Feb 9, 2023
0ad8c0a
Merge branch 'master' into branch-level-7
ChickenChiang Feb 9, 2023
5c13de8
Merge branch 'branch-Level-8'
ChickenChiang Feb 9, 2023
5034f20
Merge commit 'be7a1ad6d4dc6d185298f52a006cb21c7b77cf49'
ChickenChiang Feb 9, 2023
170bf64
Merge branch 'branch-Level-8'
ChickenChiang Feb 9, 2023
f048683
Merge branch 'master' of https://github.com/ChickenChiang/ip
ChickenChiang Feb 9, 2023
bbc1346
Merge branch 'A-Exceptions'
ChickenChiang Feb 15, 2023
e54f110
Reformatting for files and adding messages as a class
ChickenChiang Feb 15, 2023
52729dc
Replaced text with strings from Messages package
ChickenChiang Feb 15, 2023
2512bc2
Created TaskList class and its related exceptions
ChickenChiang Feb 15, 2023
cd6068a
Restructure of file to fit OOP standard
ChickenChiang Feb 15, 2023
1fca158
Added functions for UI
ChickenChiang Feb 18, 2023
9bdc21c
Created commands package and Command class
ChickenChiang Feb 19, 2023
c8ed205
Created parser package and Parser class
ChickenChiang Feb 19, 2023
cad3c2d
Command abstract class added to commands package
ChickenChiang Feb 19, 2023
3e877f7
Changed Command class into and interface instead
ChickenChiang Feb 19, 2023
74f9187
Refactoring of TaskList and Ui class to their respective packages
ChickenChiang Feb 19, 2023
e01bc3b
Cluck class now concrete
ChickenChiang Feb 19, 2023
a653274
Parser class now builds commands instead of Cluck
ChickenChiang Feb 19, 2023
365ab55
Minor fix to Ui class
ChickenChiang Feb 19, 2023
924c90e
Minor fixes to Command interface and MissingArgumentException
ChickenChiang Feb 19, 2023
eb8fe8d
Storage class added
ChickenChiang Feb 19, 2023
450c3cf
Storage class improvements
ChickenChiang Feb 19, 2023
e51bf46
Reformatted cluck to fit OOP principles
ChickenChiang Feb 19, 2023
a13eaef
Added toString() method for TaskList class
ChickenChiang Feb 19, 2023
46c2c30
Created ExitCommand and ListCommand classes
ChickenChiang Feb 19, 2023
6548a4a
MarkTaskCommand, UnmarkTaskCommand, ToDoCommand added
ChickenChiang Feb 19, 2023
0669b8b
Additional Commands created
ChickenChiang Feb 20, 2023
ea7a14c
Invalid Command and IsNotNumeric
ChickenChiang Feb 20, 2023
76cfd94
Minor fixes
ChickenChiang Feb 20, 2023
2275123
Merge branch 'A-MoreOOP'
ChickenChiang Feb 20, 2023
95c408b
Minor fixes
ChickenChiang Feb 20, 2023
0fccbda
Added test files for gradle and minor fixes
ChickenChiang Feb 21, 2023
40fb43f
Added serach by keyword method for TaskList and Task
ChickenChiang Feb 21, 2023
1c17d2a
Created and Implemented FindTaskCommand
ChickenChiang Feb 21, 2023
7df236a
Modified find Command to be not case-sensitive.
ChickenChiang Feb 21, 2023
40fa05e
Added JUnit test for task checking
ChickenChiang Feb 21, 2023
66a099d
Added exitCommandTest for Parser
ChickenChiang Feb 21, 2023
27afa01
Added JavaDocs
ChickenChiang Feb 21, 2023
84c82e3
Added JavDocs for TaskList class
ChickenChiang Feb 21, 2023
8956679
Merge branch 'branch-Level-9' into branch-A-JavaDoc
ChickenChiang Feb 21, 2023
44afac8
JavaDoc for Storage class added
ChickenChiang Feb 21, 2023
459d599
JavaDocs for Parser class added
ChickenChiang Feb 21, 2023
f247b9f
Minor fix for Messages
ChickenChiang Feb 21, 2023
9c4569d
Merge branch 'master' of https://github.com/ChickenChiang/ip into bra…
ChickenChiang Feb 21, 2023
b625d1e
JavaDocs for classes in commands package and exceptions package
ChickenChiang Feb 21, 2023
e821f98
Rename taskList package to tasklist
ChickenChiang Feb 22, 2023
5120053
Merge branch 'branch-A-JavaDoc' into branch-A-CheckStyle
ChickenChiang Feb 22, 2023
1f263ab
Merge branch 'branch-A-CheckStyle'
ChickenChiang Feb 22, 2023
1fc1c2d
Merge branch 'branch-A-JUnit'
ChickenChiang Feb 22, 2023
f8bf218
Added dependencies for JavaFX to Gradle
ChickenChiang Feb 23, 2023
30c2484
Fix Exit command and merge conflicts in Task class
ChickenChiang Mar 2, 2023
3c17451
Make Cluck class extend JavaFx's Application class and created Launch…
ChickenChiang Mar 2, 2023
3c76232
Creating a GUI for Duke
ChickenChiang Mar 2, 2023
d80c1d1
Created DialogBox class for custom controls
ChickenChiang Mar 2, 2023
556ebf7
Implemented features for Cluck's dialog box to be interactable
ChickenChiang Mar 2, 2023
ff2676b
Add custom behavior to DialogBox
ChickenChiang Mar 2, 2023
d6dd838
Added XML files and restructured the code for better OOP
ChickenChiang Mar 2, 2023
5e4993e
CheckStyle fixes
ChickenChiang Mar 2, 2023
81e21e4
Merge branch 'branch-Level-10-redo'
ChickenChiang Mar 2, 2023
7a7ce5c
Currently the jar file created with gradle using the shadow plugin is…
ChickenChiang Mar 2, 2023
32ab103
Currently the current jar file created using the shadow plugin in gr…
ChickenChiang Mar 2, 2023
85405b0
Created CorruptedDataException
ChickenChiang Mar 3, 2023
6dccea8
Fix Task class errors
ChickenChiang Mar 3, 2023
f4e2c43
Fixes to Storage, Deadline, and Event classes
ChickenChiang Mar 3, 2023
e9cf8c0
Merge pull request #2 from ChickenChiang/branch-DateTime-For-Events
ChickenChiang Mar 3, 2023
69b9fdf
Cluck! now working in GUI
ChickenChiang Mar 3, 2023
7dbd28b
Merge pull request #3 from ChickenChiang/branch-functional-Cluck-GUI
ChickenChiang Mar 3, 2023
55c0bd2
Edit to improve code quality in Cluck class
ChickenChiang Mar 3, 2023
943a308
Fixed accidental removal of import statement
ChickenChiang Mar 3, 2023
44dca79
Merge branch 'master' into branch-A-CodeQuality
ChickenChiang Mar 3, 2023
84d4eac
Merge pull request #4 from ChickenChiang/branch-A-CodeQuality
ChickenChiang Mar 3, 2023
833d7f7
Merge branch 'master' of https://github.com/ChickenChiang/ip
ChickenChiang Mar 3, 2023
947eaaf
Currently the current jar file created using the shadow plugin in gr…
ChickenChiang Mar 3, 2023
cc7736c
Merge pull request #5 from ChickenChiang/branch-A-JAR
ChickenChiang Mar 3, 2023
6c27071
Added assertions in private methods for Cluck
ChickenChiang Mar 3, 2023
8063a54
Merge pull request #6 from ChickenChiang/branch-A-Assertions
ChickenChiang Mar 3, 2023
1bb04da
Upload Ui.png into docs
ChickenChiang Mar 3, 2023
373f744
Merge pull request #7 from ChickenChiang/branch-A-UserGuide
ChickenChiang Mar 3, 2023
a782732
Updated user guide for Cluck!
ChickenChiang Mar 3, 2023
5d2bc03
Merge pull request #8 from ChickenChiang/branch-A-UserGuide
ChickenChiang Mar 3, 2023
92e92f1
Update README.md
ChickenChiang Mar 4, 2023
794ae50
Update README.md
ChickenChiang Mar 4, 2023
0c26416
Restructured Parser class to fit code quality standards
ChickenChiang Mar 4, 2023
454f236
Removed Ui class as it was made redundant with JavaFX
ChickenChiang Mar 4, 2023
6a3522b
Giving Cluck! more personality
ChickenChiang Mar 4, 2023
9923486
NoCommand created
ChickenChiang Mar 4, 2023
187f63c
Merge pull request #9 from ChickenChiang/branch-A-CodeQuality2
ChickenChiang Mar 4, 2023
6a42181
Release for version v0.2 for Cluck!
ChickenChiang Mar 4, 2023
ea8185a
Refactor code for saving data
ChickenChiang Mar 5, 2023
bdb7de9
Added flexibility for user date tiem inputs
ChickenChiang Mar 5, 2023
a0c6eb2
Fixed userGuide and readme for github pages
ChickenChiang Mar 14, 2023
3374184
Merge pull request #10 from ChickenChiang/branch-fixUserGuide
ChickenChiang Mar 14, 2023
7760aa6
Rename user guide file to README.md so github pages is working
ChickenChiang Mar 14, 2023
3e03af0
Merge branch 'master' of https://github.com/ChickenChiang/ip into bra…
ChickenChiang Mar 14, 2023
ca9393b
Merge pull request #11 from ChickenChiang/branch-fixUserGuide
ChickenChiang Mar 14, 2023
b19c87b
Edit readme for better formatting
ChickenChiang Mar 14, 2023
628e936
Merge pull request #12 from ChickenChiang/branch-fixUserGuide
ChickenChiang Mar 14, 2023
5696f00
Fixing anchoring for relative links in table of content
ChickenChiang Mar 14, 2023
74c06b1
Fixing anchor links and clarifying guide
ChickenChiang Mar 14, 2023
aafbd96
Merge pull request #13 from ChickenChiang/branch-fixUserGuide
ChickenChiang Mar 14, 2023
1a9fd8e
Improve formatting of user guide
ChickenChiang Mar 14, 2023
e68d24a
Merge pull request #14 from ChickenChiang/branch-fixUserGuide
ChickenChiang Mar 14, 2023
944c732
Fixing indentation levels
ChickenChiang Mar 14, 2023
84b8ddd
Merge pull request #15 from ChickenChiang/branch-fixUserGuide
ChickenChiang Mar 14, 2023
cb8c4e1
Fixing indentation AGAIN
ChickenChiang Mar 14, 2023
62511a4
Merge branch 'master' of https://github.com/ChickenChiang/ip into bra…
ChickenChiang Mar 14, 2023
80113b4
Merge pull request #16 from ChickenChiang/branch-fixUserGuide
ChickenChiang Mar 14, 2023
d71a7fb
Fixed pathing issue for saved file
ChickenChiang Mar 15, 2023
9eb5ee2
Minor codestyle fixes in JUnit test classes
ChickenChiang Mar 15, 2023
d99d9cb
Merge pull request #18 from ChickenChiang/branch-FixSave
ChickenChiang Mar 15, 2023
be0b09e
Merge branch 'master' into branch-C-NaturalDates
ChickenChiang Mar 15, 2023
a822193
Allow for more flexibility when entering dates
ChickenChiang Mar 18, 2023
f086a15
no message
ChickenChiang Mar 18, 2023
8d77a7e
Make Cluck! close on bye command
ChickenChiang Mar 18, 2023
28f027b
Merge pull request #19 from ChickenChiang/branch-ExitGuiOnByeCommand
ChickenChiang Mar 18, 2023
56086f7
Merge branch 'master' into branch-C-NaturalDates
ChickenChiang Mar 20, 2023
e605d95
Fixed date time formatting for tasks
ChickenChiang Mar 20, 2023
975c908
Merge pull request #20 from ChickenChiang/branch-C-NaturalDates
ChickenChiang Mar 20, 2023
feba5d8
Updated user guide
ChickenChiang Mar 20, 2023
60c8347
Merge pull request #21 from ChickenChiang/branch-UpdateUserGuide
ChickenChiang Mar 20, 2023
7015e14
Fix user guide formattiing
ChickenChiang Mar 20, 2023
abfe93f
Merge pull request #22 from ChickenChiang/branch-UpdateUserGuide
ChickenChiang Mar 20, 2023
b329b64
Delete Cluck!.zip
ChickenChiang Mar 20, 2023
f99848d
Remove DateTimeHandler class
ChickenChiang Mar 20, 2023
81ff40d
Fix checkstyle errors
ChickenChiang Mar 20, 2023
e3608e4
fix checkstyle
ChickenChiang Mar 20, 2023
211bdb5
Merge branch 'master' into branch-C-NaturalDates
ChickenChiang Mar 20, 2023
fe68fca
Merge pull request #23 from ChickenChiang/branch-C-NaturalDates
ChickenChiang Mar 20, 2023
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
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ src/main/resources/docs/
*.iml
bin/

/text-ui-test/ACTUAL.TXT
/text-ui-test/ACTUAL.txt
text-ui-test/EXPECTED-UNIX.TXT
15 changes: 15 additions & 0 deletions src/main/java/Deadline.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
public class Deadline extends Task {
protected String dueDate;

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

@Override
public String toString() {
return this.isMarked
? String.format("[D][X] %1$s (by: %2$s)", this.description, this.dueDate)
: String.format("[D][ ] %1$s (by: %2$s)", this.description, this.dueDate);
Copy link

Choose a reason for hiding this comment

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

Could this method make use of abstraction so that the toString() method in the parent class Task could be used here? Then, you would only need to add the correct task icon ("D" for Deadline here) and the due date, making it easier to read.

}
}
196 changes: 190 additions & 6 deletions src/main/java/Duke.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,194 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;

public class Duke {
static private final String MAKE_DEADLINE = "deadline";
static private final String MAKE_TODO = "todo";
static private final String MAKE_EVENT = "event";
static private final String DUE_DATE_FLAG = "/by ";
static private final String EVENT_START_FLAG = "/from ";
static private final String EVENT_END_FLAG = "/to ";
Copy link

Choose a reason for hiding this comment

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

Should the "static" keyword come before the access modifier ("private" in this case)?
private static final might be the preferred format.

Namings align with the coding standard, which is great!


public static boolean isNumeric(String strNum) {
if (strNum == null) {

Choose a reason for hiding this comment

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

Love your code! Tidy and clean

return false;
}
try {
double d = Double.parseDouble(strNum);
} catch (NumberFormatException nfe) {
return false;
}
return true;
}

public static void main(String[] args) {
String logo = " ____ _ \n"
+ "| _ \\ _ _| | _____ \n"
+ "| | | | | | | |/ / _ \\\n"
+ "| |_| | |_| | < __/\n"
+ "|____/ \\__,_|_|\\_\\___|\n";
System.out.println("Hello from\n" + logo);
String logo = " _____ _ _____ _\n"
+ "| ___|| | _ _ | ___| | | _\n"
+ "| | | | | | | | | | | |/ /\n"
+ "| |___ | |___ | |__| | | |___ | \\\n"
+ "|_____||_____||______| |_____| |_| \\_\\\n";
ChickenChiang marked this conversation as resolved.
Show resolved Hide resolved

System.out.println(logo);
System.out.println(" ____________________________________________________________");
System.out.println(" Howdy! I'm Cluck!\n" +
" What can I cluck-a-doodle-do for you?\n");
System.out.println(" ____________________________________________________________");

boolean loop = true;
List<Task> toDoList = new ArrayList<>();
Copy link

Choose a reason for hiding this comment

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

Perhaps a better name could be used for the boolean name sound more like a boolean. toDoList could also be renamed to be more specific and descriptive of a container of multiple tasks.

Suggested change
boolean loop = true;
List<Task> toDoList = new ArrayList<>();
boolean isActive = true;
List<Task> tasks = new ArrayList<>();

Scanner sc = new Scanner(System.in);

while (loop) {
String input = sc.nextLine();

Choose a reason for hiding this comment

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

Should we add a sc.close() at the end

String[] words = input.split(" ");

switch (words[0]) {
case "bye":
System.out.println(" ____________________________________________________________");
System.out.println(" Buh-cluck, see ya!");
System.out.println(" ____________________________________________________________");
loop = false;
break;

case "list":
System.out.println(" ____________________________________________________________");
System.out.println(" Here are the tasks in your list:");
for (int i = 0; i < toDoList.size(); i++) {
System.out.println(" " + (i + 1) + ": " + toDoList.get(i).toString());
}
System.out.println(" ____________________________________________________________");
break;

case "mark":
if (words.length == 1) {
System.out.println(" ____________________________________________________________");
System.out.println(" Mucka blucka - Buh cluck! Which task do you wanna mark? ");
System.out.println(" ____________________________________________________________");
}
else if (isNumeric(words[1])) {
Integer itemNumber = Integer.parseInt(words[1]);
if (itemNumber > toDoList.size() || itemNumber <= 0) {
System.out.println(" ____________________________________________________________");
System.out.println(" That's not...? In the list...? Buh caw?");
System.out.println(" ____________________________________________________________");
} else {
toDoList.get(itemNumber - 1).mark();
System.out.println(" ____________________________________________________________");
System.out.println(String.format(" Marked it! Cluck-a-doodle-done!\n %s", toDoList.get(itemNumber - 1).toString()));
System.out.println(" ____________________________________________________________");
}
} else {
System.out.println(" ____________________________________________________________");
System.out.println(" Ya gotta give me a working number, bucko!");
System.out.println(" ____________________________________________________________");
}
break;

case "unmark":
if (words.length == 1) {
System.out.println(" ____________________________________________________________");
System.out.println(" Which task do you wanna unmark? Muckah buck!");
System.out.println(" ____________________________________________________________");
} else if (isNumeric(words[1])) {
Integer itemNumber = Integer.parseInt(words[1]);
if (itemNumber > toDoList.size() || itemNumber <= 0) {
System.out.println(" ____________________________________________________________");
System.out.println(" That's not...? In the list...? Buh caw?");
System.out.println(" ____________________________________________________________");
} else {
toDoList.get(itemNumber - 1).unmark();
System.out.println(" ____________________________________________________________");
System.out.println(String.format(" Unmarked it! Cluckiddy cluck!\n %s", toDoList.get(itemNumber - 1).toString()));
System.out.println(" ____________________________________________________________");
}
} else {
System.out.println(" ____________________________________________________________");
System.out.println(" Ya gotta give me a working number, bucko!");
System.out.println(" ____________________________________________________________");
}
break;

case MAKE_TODO:
Task newTodo = new ToDo(input.substring(5));
toDoList.add(newTodo);
System.out.println(" ____________________________________________________________");
System.out.println(" added todo: \n " + newTodo.toString());
System.out.println(" Now there's " + toDoList.size() + " items in your list!");
System.out.println(" ____________________________________________________________");
break;

case MAKE_DEADLINE:
String body = input.substring(9);
if (body.contains(DUE_DATE_FLAG)) {
String[] fields = body.split(DUE_DATE_FLAG);
String description = fields[0];
String dueDate = fields[1];
Task currDeadline = new Deadline(description, dueDate);
toDoList.add(currDeadline);
System.out.println(" ____________________________________________________________");
System.out.println(" added deadline: " + currDeadline.toString());
System.out.println(" Now there's " + toDoList.size() + " items in your list!");
System.out.println(" ____________________________________________________________");
break;
}

System.out.println(" ____________________________________________________________");
System.out.println(" You're missing the '/by' flag, bucko!");
System.out.println(" ____________________________________________________________");
break;

case MAKE_EVENT:
String substring = input.substring(6);
if (substring.contains(EVENT_START_FLAG) && substring.contains(EVENT_END_FLAG)) {
String[] fields = substring.split("/\\w{2,4}\\s");
System.out.println(Arrays.toString(fields));
Task currEvent = new Event(fields[0], fields[1], fields[2]);
toDoList.add(currEvent);
System.out.println(" ____________________________________________________________");
System.out.println(" added event: " + currEvent.toString());
System.out.println(" Now there's " + toDoList.size() + " items in your list!");
System.out.println(" ____________________________________________________________");
break;
}
System.out.println(" ____________________________________________________________");
System.out.println(" You're missing the either the '/from' or '/to' flag, or both! Buhcock!");
System.out.println(" ____________________________________________________________");
break;

case "delete":
if (words.length == 1) {
System.out.println(" ____________________________________________________________");
System.out.println(" Mucka blucka - Buh cluck! Which task do you wanna delete? ");
System.out.println(" ____________________________________________________________");
}
else if (isNumeric(words[1])) {
Integer itemNumber = Integer.parseInt(words[1]);
if (itemNumber > toDoList.size() || itemNumber <= 0) {
System.out.println(" ____________________________________________________________");
System.out.println(" That's not...? In the list...? Buh caw?");

Choose a reason for hiding this comment

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

Interesting and Creative ui design

System.out.println(" ____________________________________________________________");
} else {
System.out.println(" ____________________________________________________________");
System.out.println(String.format(" Buh cuck! Removed the following:\n %s", toDoList.get(itemNumber - 1).toString()));
System.out.println(" ____________________________________________________________");
toDoList.remove(itemNumber - 1);
}
} else {
System.out.println(" ____________________________________________________________");
System.out.println(" Ya gotta give me a working number, bucko!");
System.out.println(" ____________________________________________________________");
}
break;


default:
System.out.println(" ____________________________________________________________");
System.out.println(" You gotta give me a command!");
System.out.println(" ____________________________________________________________");

Copy link

Choose a reason for hiding this comment

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

Perhaps remove unnecessary white spaces between lines of code, such as within the switch statement? So that the format is standardised. This applies to some parts above too.

}
}
}
}
17 changes: 17 additions & 0 deletions src/main/java/Event.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
public class Event extends Task {
protected String startTime;
protected String endTime;

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

@Override
public String toString(){
return this.isMarked
? String.format("[E][X] %1$s (from:%2$s to:%3$s)", this.description, this.startTime, this.endTime)
: String.format("[E][ ] %1$s (from:%2$s to:%3$s)", this.description, this.startTime, this.endTime);
Copy link

Choose a reason for hiding this comment

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

Similar to the comment under Deadline, perhaps this could make use of the toString() method in the parent class Task?

}
}
24 changes: 24 additions & 0 deletions src/main/java/Task.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
public class Task {
protected String description; // name of the task
protected Boolean isMarked; // whether task is done or not

public Task(String description) {
this.description = description;
this.isMarked = false;
}
public void mark() {
this.isMarked = true;
}

public void unmark() {
this.isMarked = false;
}

@Override
public String toString() {
return this.isMarked
? String.format("[X] %s", this.description)
: String.format("[ ] %s", this.description);
}

}
11 changes: 11 additions & 0 deletions src/main/java/ToDo.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
public class ToDo extends Task{

public ToDo(String description) {
super(description);
}

@Override
public String toString() {
return "[T]" + super.toString();
}
}
23 changes: 17 additions & 6 deletions text-ui-test/EXPECTED.TXT
Original file line number Diff line number Diff line change
@@ -1,7 +1,18 @@
Hello from
____ _
| _ \ _ _| | _____
| | | | | | | |/ / _ \
| |_| | |_| | < __/
|____/ \__,_|_|\_\___|
_____ _ _____ _
| ___|| | _ _ | ___| | | _
| | | | | | | | | | | |/ /
| |___ | |___ | |__| | | |___ | \
|_____||_____||______| |_____| |_| \_\

____________________________________________________________
Howdy! I'm Cluck!
What can I cluck-a-doodle-do for you?

____________________________________________________________
____________________________________________________________
added deadline: [D][ ] Eat cookies (by: tonight)
Now there's 1 items in your list!
____________________________________________________________
____________________________________________________________
Buh-cluck, see ya!
____________________________________________________________
2 changes: 2 additions & 0 deletions text-ui-test/input.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
deadline Eat cookies /by tonight
bye