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

[Qiu Qianhui] iP #376

Open
wants to merge 60 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
556af3f
Add Gradle support
May 24, 2020
2abf484
Add Increment Level-1
QQH0828 Jan 30, 2023
6e6c66f
Add Increment Level-2
QQH0828 Jan 30, 2023
8e390d2
Add Increment Level-3 with a new class Task
QQH0828 Jan 30, 2023
63deb9f
Add Increments Level-4
QQH0828 Jan 31, 2023
638fe5e
Add Increments for Automated Text UI Testing
QQH0828 Jan 31, 2023
fea77b0
Add Increment Level-5
QQH0828 Jan 31, 2023
a6d87e4
Add Increment Level-6
QQH0828 Jan 31, 2023
a57249e
Add Increment Level -7 as parallel branche with Save method
QQH0828 Feb 7, 2023
1bc3b13
Merge branch 'branch-Level-7'
QQH0828 Feb 7, 2023
3d7c8f3
Merge branch 'branch-Level-8'
QQH0828 Feb 7, 2023
f308ef4
Add Increments as parallel branche-Level-8 with Dates and Times
QQH0828 Feb 7, 2023
eaeedb9
Add Increments as parallel branch-Level-7 with Save method
QQH0828 Feb 7, 2023
db837df
Merge branch 'branch-Level-7'
QQH0828 Feb 7, 2023
1e9262f
Merge branch 'branch-Level-8'
QQH0828 Feb 7, 2023
e1c0c5e
Solve merge conflict branch-Level-8
QQH0828 Feb 7, 2023
858927b
Merge remote-tracking branch 'origin/master'
QQH0828 Feb 7, 2023
c88a915
Merge branch 'add-gradle-support' of https://github.com/nus-cs2103-AY…
QQH0828 Feb 7, 2023
817bcee
Add Increment: A-MoreOOP
QQH0828 Feb 12, 2023
6a8cd60
Add Increment: A-Packages
QQH0828 Feb 12, 2023
1a75274
Add Increment: A-Gradle
QQH0828 Feb 12, 2023
f896222
Add Increment: A-JUnit
QQH0828 Feb 13, 2023
5e84399
Add Increments as parallel branches: A-JavaDoc
QQH0828 Feb 13, 2023
06a30bd
Add Increments as parallel branches: Level-9
QQH0828 Feb 13, 2023
bc80cb8
Add Increments as parallel branches: Level-9
QQH0828 Feb 13, 2023
2afc403
Add Increments as parallel branches: A-CodingStandard
QQH0828 Feb 13, 2023
b05471e
Merge branch 'branch-A-JavaDoc'
QQH0828 Feb 13, 2023
0f3fe17
Merge branch 'branch-Level-9'
QQH0828 Feb 13, 2023
a7b2d76
Merge branch 'branch-A-CodingStandard'
QQH0828 Feb 13, 2023
895bae8
Add Increments as branches: A-CheckStyle
QQH0828 Feb 13, 2023
d3b4044
Delete unused classes
QQH0828 Feb 15, 2023
74bdb53
Add Increments as branches: Level-10
QQH0828 Feb 15, 2023
ff5718d
Merge branch 'branch-Level-10'
QQH0828 Feb 15, 2023
e9c03a4
Add assert statement in the TaskList class
QQH0828 Feb 15, 2023
6c72fb3
Modify the codes based on the code quality
QQH0828 Feb 15, 2023
bc2e9a6
Merge pull request #2 from QQH0828/branch-A-Assertions
QQH0828 Feb 15, 2023
3e7ebc9
Merge branch 'master' of https://github.com/QQH0828/ip
QQH0828 Feb 15, 2023
2c7366f
Merge pull request #3 from QQH0828/branch-A-CodeQuality
QQH0828 Feb 15, 2023
11b85c6
Merge branch 'master' of https://github.com/QQH0828/ip
QQH0828 Feb 15, 2023
da2cede
Merge branch 'master' into branch-A-Assertions
QQH0828 Feb 15, 2023
9e36d1c
Merge branch 'master' into branch-A-CodeQuality
QQH0828 Feb 15, 2023
4ef0415
Merge branch 'branch-A-Assertions'
QQH0828 Feb 15, 2023
4b65663
Merge branch 'branch-A-CodeQuality'
QQH0828 Feb 15, 2023
f7f30c0
Add Increment: A-CI
QQH0828 Feb 15, 2023
3a8547a
Add an extension: C-Help
QQH0828 Feb 16, 2023
786fd75
Merge branch 'branch-C-Help'
QQH0828 Feb 16, 2023
9e53f70
Fix CheckStyle errors
QQH0828 Feb 16, 2023
85a4776
Add a unique personality
QQH0828 Feb 17, 2023
6882f68
Resolve the command error
QQH0828 Feb 17, 2023
ac99812
Fix the import format order issues
QQH0828 Feb 17, 2023
3b97191
Fix import format in parser class
QQH0828 Feb 17, 2023
9ff9abb
Fix checkstyle error
QQH0828 Feb 17, 2023
26f91eb
Add java doc in ui class
QQH0828 Feb 17, 2023
832d46a
Fix checkstyle error of DeadlineTest and DateTimeTest classes
QQH0828 Feb 17, 2023
f7536e5
Fix the checkstyle error in the DateTimeTest class
QQH0828 Feb 17, 2023
abd962b
Set up a product website with a representative screenshot and user guide
QQH0828 Feb 17, 2023
769a11d
Add help command in the user guide
QQH0828 Feb 17, 2023
b5d8dc4
Finalize the features
QQH0828 Feb 17, 2023
8cd75f8
Fix no match tasks while using find command
QQH0828 Feb 17, 2023
a19d9e3
Fix some errors to make it more user friendly
QQH0828 Feb 17, 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
13 changes: 13 additions & 0 deletions src/main/java/Deadline.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
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 + ")";
}
}
73 changes: 58 additions & 15 deletions src/main/java/Duke.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ public class Duke {

private Scanner input = new Scanner(System.in);
private Task tasks[] = new Task[100];
private int size = 0;
private int taskIndex = 0;

public void start() {
String logo = "\t ____ _ \n"
Expand All @@ -14,43 +14,88 @@ public void start() {
+ "\t |____/ \\__,_|_|\\_\\___|\n";
System.out.println(logo);
System.out.println("\t Hello! I'm Duke");
System.out.println("\t What can I do for you?");
System.out.println("\t What can I do for you?\n");
}

public void display() {
System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n");
}

public void mark(String command) {
int taskindex = Integer.parseInt(command.split(" ")[1]) - 1;
tasks[taskindex].mark();
int index = Integer.parseInt(command.split(" ")[1]) - 1;
tasks[index].mark();
}

public void unmark(String command) {
int taskindex = Integer.parseInt(command.split(" ")[1]) - 1;
tasks[taskindex].unmark();
int index = Integer.parseInt(command.split(" ")[1]) - 1;
tasks[index].unmark();
}

public void list() {
for (int i = 0; i < size; i++) {
System.out.print("\t " + (i + 1) + ".");
tasks[i].showTask();
for (int i = 0; i < taskIndex; i++) {
System.out.print("\t " + (i + 1) + "." + tasks[i].toString() + "\n");
}
System.out.print("\n");
}

public void addTask(Task task) {
tasks[taskIndex] = task;
taskIndex++;
System.out.println("\t Got it. I've added this task:\n"
Copy link

Choose a reason for hiding this comment

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

I like what you did here - indenting and spacing a sentence into parts that are more readable!

+ "\t\t "+ tasks[taskIndex - 1].toString()
+ "\n\t Now you have " + taskIndex + " tasks in the list.\n");
}
public void todo(String command) {
String description = command.split(" ", 2)[1];
Todo todo = new Todo(description);
addTask(todo);
}

public void deadline(String command) {
String info[] = command.split(" ", 2)[1].split(" /by ");
Copy link

Choose a reason for hiding this comment

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

Perhaps we could use a variable name that indicates this is an array? Also, remember to have the square brackets right after the data type~! (String[])

String description = info[0];
String by = info[1];
Copy link

Choose a reason for hiding this comment

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

Maybe instead of just "by", we can use a variable name that indicates that this is a date?

Deadline deadline = new Deadline(description, by);
addTask(deadline);
}

public void event(String command) {
String info[] = command.split(" ", 2)[1].split(" /from ");
Copy link

Choose a reason for hiding this comment

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

Ooh I like your clever usage of split to distinguish between /to argument and /from argument!

String description = info[0];
String dates[] = info[1].split(" /to ");
String from = dates[0];
String to = dates[1];

Event event = new Event(description, from, to);
addTask(event);
}

public void run() {
start();
while (true) {
String command = input.nextLine();
if (command.equals("bye")) {
display();
System.out.println("\t Bye. Hope to see you again soon!");
break;
} else if (command.equals("list")) {
display();
list();
} else if (command.startsWith("mark")) {
display();
mark(command);
} else if (command.startsWith("unmark")) {
display();
unmark(command);
} else {
tasks[size] = new Task(command);
size++;
System.out.println("\t added: " + command);
} else if (command.startsWith("todo")) {
display();
todo(command);
} else if (command.startsWith("deadline")) {
display();
deadline(command);
} else if(command.startsWith("event")) {
display();
event(command);
}
}
}
Expand All @@ -60,5 +105,3 @@ public static void main(String[] args) {
duke.run();
}
}


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 from;
protected String to;

public Event(String description, String from, String to) {
super(description);
this.from = from;
this.to = to;
}
@Override
public String toString() {
return "[E]" + super.toString() + " (from: " + from + " to: " + to + ")";
}
}
9 changes: 5 additions & 4 deletions src/main/java/Task.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,17 @@ public String getStatusIcon() {
public void mark() {
this.isDone = true;
System.out.println("\t Nice! I've marked this task as done:\n"
+ "\t\t [X] " + this.description);
+ "\t\t [X] " + this.description + "\n");
}

public void unmark() {
this.isDone = false;
System.out.println("\t OK, I've marked this task as not done yet:\n"
+ "\t\t [ ] " + this.description);
+ "\t\t [ ] " + this.description + "\n");
}

public void showTask() {
System.out.println(" [" + getStatusIcon() + "] " + this.description);
@Override
public String toString() {
return " [" + getStatusIcon() + "] " + this.description;
}
}
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();
}
}