- Learn about the project
- Set up prerequisites
- Set up the project in your computer
- Add Increments while committing frequently:
Level-1
,Level-2
,Level-3
,Level-4
,A-TextUiTesting
,Level-5
,Level-6
,A-Enums
by Thursday 2359
The iP (and the tP) undergoes changes after each semester. As such, teething issues are a possibility. If you encounter any problem while doing the iP/tP, please post in the forum so that we can take necessary actions.
We discourage you from doing project tasks allocated to future weeks. Reasons: In order to help you gain the ability to apply knowledge or do tasks effortlessly as if you have been doing them for a long timefluency (and also to better simulate real projects), we want the project work to be done at multiple times with time gaps in betweenspaced and spread over a longer period, rather than to be done as a short burst. Reminder: as per iP grading criteria, some increments need to to be done in each week for you to get full marks.
1 Learn about the project
- Read the following two sections, if you haven't done so already:
Admin iP - Overview
Admin iP - Grading
2 Set up prerequisites
- Ensure you have followed the Preparation sections of the following module tools:
Admin Programming Language
Admin Tools → Git
Admin Tools → GitHub
Admin Tools → Intellij IDEA
3 Set up the project in your computer
- Fork https://github.com/nus-cs2103-AY1920S2/duke.
- Enable the issue tracker of your fork (Go to
Settings
of your fork, scroll to theFeatures
section, and tick theIssues
checkbox). Reason: our bots will be posting your weekly progress reports on the issue tracker of your fork.
If the issue tracker is enabled, you should be able to visit the following URLhttps://github.com/{your_user_name}/duke/issues
e.g.,https://github.com/johnDoe/duke/issues
- Clone the fork onto your computer.
- Set up the project in your IDE as explained in the README file.
If you are somewhat familiar with build tools such as Gradle, you are free to go ahead and start using Gradle from the beginning by following the Gradle tutorial.
4 Add Increments while committing frequently: Level-1
, Level-2
, Level-3
, Level-4
, A-TextUiTesting
, Level-5
, Level-6
, A-Enums
by Thursday 2359
- Implement the following in this context, an increment is a Duke level or a Duke extensionincrements in the given order.
- From this point onward, commit code at important points. Minimally, commit after completing each increment.
- From this point onward, after completing each increment,
git tag
the commit with the exact increment ID e.g.,Level-2
,A-TextUiTesting
git push
the code to your fork ( git doesn't push tags unless you specifically ask it to)
Level-1
: Greet, Echo, Exit
Level 1. Greet, Echo, Exit
In this initial skeletal version of Duke, it starts by greeting the user, simply echos commands entered by the user, and exits when the user types bye
.
Example:
____________________________________________________________
Hello! I'm Duke
What can I do for you?
____________________________________________________________
list
____________________________________________________________
list
____________________________________________________________
blah
____________________________________________________________
blah
____________________________________________________________
bye
____________________________________________________________
Bye. Hope to see you again soon!
____________________________________________________________
- The indentation and horizontal lines are optional.
You are strongly encouraged to customize the chatbot name, command/display formats, and even the personality of the chatbot to make your chatbot unique.
Level-2
: Add, List
Level 2. Add, List
Add the ability to store whatever text entered by the user and display them back to the user when requested.
Example:
____________________________________________________________
Hello! I'm Duke
What can I do for you?
____________________________________________________________
read book
____________________________________________________________
added: read book
____________________________________________________________
return book
____________________________________________________________
added: return book
____________________________________________________________
list
____________________________________________________________
1. read book
2. return book
____________________________________________________________
bye
____________________________________________________________
Bye. Hope to see you again soon!
____________________________________________________________
- There is no need to save the data to the hard disk.
- Assume there will be no more than 100 tasks. If you wish, you may use a fixed size array (e.g.,
String[100]
) to store the items.
Level-3
: Mark as Done
Level 3. Mark as Done
Add the ability to mark tasks as done.
list
____________________________________________________________
Here are the tasks in your list:
1.[✓] read book
2.[✗] return book
3.[✗] buy bread
____________________________________________________________
done 2
____________________________________________________________
Nice! I've marked this task as done:
[✓] return book
____________________________________________________________
When implementing this feature, you are also recommended to implement the following extension:
Extension: A-Classes
While it is possible to represent a task list as a multi-dimensional array containing String
, int
, boolean
etc.primitive values, the more natural approach is to use a Task
class to represent tasks.
Partial solution
public class Task {
protected String description;
protected boolean isDone;
public Task(String description) {
this.description = description;
this.isDone = false;
}
public String getStatusIcon() {
return (isDone ? "\u2713" : "\u2718"); //return tick or X symbols
}
//...
}
Task t = new Taks("read book");
t.markAsDone()
Level-4
: ToDo, Event, Deadline
Level 4. ToDos, Events, Deadlines
Add support for tracking three types of tasks:
- ToDos: tasks without any date/time attached to it e.g., visit new theme park
- Deadlines: tasks that need to be done before a specific date/time e.g., submit report by 11/10/2019 5pm
- Events: tasks that start at a specific time and ends at a specific time e.g., team project meeting on 2/10/2019 2-4pm
Example:
todo borrow book
____________________________________________________________
Got it. I've added this task:
[T][✗] borrow book
Now you have 5 tasks in the list.
____________________________________________________________
list
____________________________________________________________
Here are the tasks in your list:
1.[T][✓] read book
2.[D][✗] return book (by: June 6th)
3.[E][✗] project meeting (at: Aug 6th 2-4pm)
4.[T][✓] join sports club
5.[T][✗] borrow book
____________________________________________________________
deadline return book /by Sunday
____________________________________________________________
Got it. I've added this task:
[D][✗] return book (by: Sunday)
Now you have 6 tasks in the list.
____________________________________________________________
event project meeting /at Mon 2-4pm
____________________________________________________________
Got it. I've added this task:
[E][✗] project meeting (at: Mon 2-4pm)
Now you have 7 tasks in the list.
____________________________________________________________
At this point, dates/times can be treated as strings; there is no need to convert them to actual dates/times.
Example:
deadline do homework /by no idea :-p
____________________________________________________________
Got it. I've added this task:
[D][✗] do homework (by: no idea :-p)
Now you have 6 tasks in the list.
____________________________________________________________
When implementing this feature, you are also recommended to implement the following extension:
Extension: A-Inheritance
As there are multiple types of tasks that have some similarity between them, you can implement classes Todo
, Deadline
and Event
classes to inherit from a Task
class.
Furthermore, use polymorphism to store all tasks in a data structure containing Task
objects e.g., Task[100]
.
Partial solution
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 + ")";
}
}
Task[] tasks = new Task[100];
task[0] = new Deadline("return book", "Monday");
Level-5
: Handle Errors
Level 5. Handle Errors
Teach Duke to deal with errors such as incorrect inputs entered by the user.
Example:
todo
____________________________________________________________
☹ OOPS!!! The description of a todo cannot be empty.
____________________________________________________________
blah
____________________________________________________________
☹ OOPS!!! I'm sorry, but I don't know what that means :-(
____________________________________________________________
When implementing this feature, you are also recommended to implement the following extension:
- Minimal: handle at least the two types of errors shown in the example above.
- Stretch goal: handle all possible errors in the current version. As you evolve Duke, continue to handle errors related to the new features added.
Level-6
: Delete
Level 6. Delete
Add support for deleting tasks from the list.
Example:
list
____________________________________________________________
Here are the tasks in your list:
1.[T][✓] read book
2.[D][✓] return book (by: June 6th)
3.[E][✗] project meeting (at: Aug 6th 2-4pm)
4.[T][✓] join sports club
5.[T][✗] borrow book
____________________________________________________________
delete 3
____________________________________________________________
Noted. I've removed this task:
[E][✗] project meeting (at: Aug 6th 2-4pm)
Now you have 4 tasks in the list.
____________________________________________________________