Skip to content
Open
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
3b19ba1
Add Gradle support
May 24, 2020
a75fcee
build.gradle: Update version to 8.29
Aug 29, 2020
407ffa5
Level-1
chanellNg Jan 21, 2021
06f0689
Add files via upload
chanellNg Jan 21, 2021
9b617be
Level-2
chanellNg Jan 21, 2021
4006726
Update Level_1.java
chanellNg Jan 21, 2021
5487996
Add files via upload
chanellNg Jan 21, 2021
b5c3290
update
chanellNg Jan 21, 2021
27b1dca
Delete Level_1.java
chanellNg Jan 21, 2021
2ebb099
Delete Level_2.java
chanellNg Jan 21, 2021
575b392
Merge branch 'master' of https://github.com/chanellNg/ip
chanellNg Jan 21, 2021
ce02ad4
Level-3
chanellNg Jan 21, 2021
38ed607
Level-4
chanellNg Jan 21, 2021
45deb86
Level-6
chanellNg Jan 21, 2021
ae29bdd
update
chanellNg Jan 21, 2021
ec45d14
A-TextUiTesting
chanellNg Jan 27, 2021
8dfff5e
Level-7
chanellNg Jan 31, 2021
5557dcb
Delete Level_7.java
chanellNg Jan 31, 2021
cabc8e2
Level-7 branch
chanellNg Jan 31, 2021
ff30251
Level-8 branch
chanellNg Jan 31, 2021
73a64ba
Level-8
chanellNg Jan 31, 2021
8a94ea4
Merge branch 'branch-Level-8'
chanellNg Jan 31, 2021
c942d11
branch-A-JavaDoc
chanellNg Jan 31, 2021
4f0a9d5
Add files via upload
chanellNg Jan 31, 2021
add4617
Merge branch 'master' of https://github.com/chanellNg/ip
chanellNg Jan 31, 2021
1c760e8
Merge branch 'master' of https://github.com/chanellNg/ip
chanellNg Jan 31, 2021
d10b9a1
Merge branch 'branch-A-JavaDoc'
chanellNg Jan 31, 2021
743980d
A-MoreOOP
chanellNg Feb 1, 2021
26ef9ce
OOP
chanellNg Feb 1, 2021
b7970f1
A-Packages
chanellNg Feb 1, 2021
c72addf
A-JUnit
chanellNg Feb 1, 2021
a929bc3
A-JUnit
chanellNg Feb 1, 2021
d3c2107
A-CodingStandard and A-JavaDoc
chanellNg Feb 2, 2021
11af796
Added JavaDoc comments.
chanellNg Feb 2, 2021
97c5ab0
branch-Level-9
chanellNg Feb 2, 2021
2b307f3
Level-9
chanellNg Feb 2, 2021
7fd1218
Merge remote-tracking branch 'origin/add-gradle-support'
chanellNg Feb 8, 2021
98b7b46
Updated Gradle and Checkstyle
chanellNg Feb 8, 2021
4851440
Level-10
chanellNg Feb 9, 2021
498e37f
Level-10 GUI
chanellNg Feb 9, 2021
17312a9
Added resources files
chanellNg Feb 9, 2021
8d0acb9
Added assert statments
chanellNg Feb 13, 2021
ed4a16f
Merge pull request #2 from chanellNg/branch-A-Assertions
chanellNg Feb 13, 2021
aeb15f7
Made changes to improve code quality
chanellNg Feb 13, 2021
d5e2d9a
Merge pull request #3 from chanellNg/branch-A-CodeQuality
chanellNg Feb 13, 2021
bd46e79
BCD extention- adding edit functionality
chanellNg Feb 13, 2021
446ca55
Added BCD extentsion -Edit function
chanellNg Feb 13, 2021
194b0bc
Updated user guide and made changes to Ui
chanellNg Feb 17, 2021
6f462ad
Added product snapshot
chanellNg Feb 17, 2021
925acea
Set theme jekyll-theme-cayman
chanellNg Feb 17, 2021
28aa931
Updated background color
chanellNg Feb 17, 2021
7bebc15
Delete Ui.png
chanellNg Feb 17, 2021
77eec58
Merge branch 'master' of https://github.com/chanellNg/ip
chanellNg Feb 17, 2021
b231f90
Updated Ui
chanellNg Feb 17, 2021
b2572af
Updated gui and shadowJar
chanellNg Feb 17, 2021
87ed919
Set theme jekyll-theme-minimal
chanellNg Feb 17, 2021
6cd61be
Updated user guide in docs folder
chanellNg Feb 17, 2021
b993914
Merge branch 'master' of https://github.com/chanellNg/ip
chanellNg Feb 17, 2021
17cda08
Set theme jekyll-theme-cayman
chanellNg Feb 17, 2021
30702c2
Updated JavaDoc comments
chanellNg Feb 18, 2021
fffce7c
Merge branch 'master' of https://github.com/chanellNg/ip
chanellNg Feb 18, 2021
b65e6ea
Update README.md
chanellNg Jun 9, 2021
d1837f3
Update README.md
chanellNg Jun 11, 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
17 changes: 17 additions & 0 deletions src/main/java/Deadline.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
public class Deadline extends Task{
protected String by;

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

@Override
public String toString() {
if(!this.done){
return "[D][ ] " + super.toString() + " (by: " + by + ")";
}else {
return "[D][X] " + super.toString() + " (by: " + by + ")";
}
}
}
47 changes: 47 additions & 0 deletions src/main/java/Duke.java
Original file line number Diff line number Diff line change
@@ -1,4 +1,51 @@
import java.util.*;
public class Duke {
List<Task> list;

public Duke(){
this.list = new ArrayList<>();
}
public void greet(){
System.out.println("Hello! I'm Duke");
System.out.println("What can I do for you?");
}

public void echo(String input){
System.out.println(input);

}

public void addToList(Task task){
this.list.add(task);
System.out.println("Got it. I've added this task: ");
System.out.println(" " + task);
System.out.println("Now you have " + String.valueOf(this.list.size()) + " tasks in the list.");
}

public void printList(){
int counter = 1;
for(Task element:this.list){
System.out.println(String.valueOf(counter) + element);
counter++;
}
}

public void markTaskAsDone(int id){
Task task = this.list.get(id-1);
task.markDone();
System.out.println("Nice! I've marked this task as done:");
System.out.println(" [X] "+ task.content);
}

public void deleteTask(int id){
Task task = this.list.get(id-1);
this.list.remove(id-1);
System.out.println("Noted. I've removed this task: ");
System.out.println(" " + task);
System.out.println("Now you have " + String.valueOf(this.list.size()) + " tasks in the list.");

}

public static void main(String[] args) {
String logo = " ____ _ \n"
+ "| _ \\ _ _| | _____ \n"
Expand Down
10 changes: 10 additions & 0 deletions src/main/java/DukeException.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
public class DukeException extends Exception{
public DukeException(String message){
super(message);
}

@Override
public String toString(){
return this.getMessage();
}
}
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 at;

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

@Override
public String toString() {
if(!this.done){
return "[E][ ] " + super.toString() + " (at: " + at + ")";
}else {
return "[E][X] " + super.toString() + " (at: " + at + ")";
}
}
}
18 changes: 18 additions & 0 deletions src/main/java/Level_1.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import java.util.*;

public class Level_1 {
public static void main(String[] args) {
System.out.println("Hello! I'm Duke");
System.out.println("What can I do for you?");
Scanner sc = new Scanner(System.in);
String input = sc.next();
Duke bot = new Duke();

while(!(input.equals("bye"))){
bot.echo(input);
input = sc.next();
}

System.out.println("Bye. Hope to see you again soon!");
}
}
25 changes: 25 additions & 0 deletions src/main/java/Level_2.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import java.util.*;

public class Level_2 {
public static void main(String[] args) {
System.out.println("Hello! I'm Duke");
System.out.println("What can I do for you?");
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();
Duke bot = new Duke();
//int counter = 1;

while(!(input.equals("bye"))) {
if (input.equals("list")) {
bot.printList();
}else{
Task newTask = new Task(input);
bot.addToList(newTask);
//counter++;
}
input = sc.nextLine();
}

System.out.println("Bye. Hope to see you again soon!");
}
}
32 changes: 32 additions & 0 deletions src/main/java/Level_3.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import java.util.*;

public class Level_3 {
public static void main(String[] args) {
System.out.println("Hello! I'm Duke");
System.out.println("What can I do for you?");
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();
Duke bot = new Duke();
//int counter = 1;

while(!(input.equals("bye"))) {
if (input.equals("list")) {
bot.printList();
}else{
String command = input.split(" ")[0];
if(command.equals("done")){
int id = Integer.valueOf(input.split(" ")[1]);
bot.markTaskAsDone(id);

}else {
Task newTask = new Task(input);
bot.addToList(newTask);
//counter++;
}
}
input = sc.nextLine();
}

System.out.println("Bye. Hope to see you again soon!");
}
}
46 changes: 46 additions & 0 deletions src/main/java/Level_4.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import java.util.*;

public class Level_4 {
public static void main(String[] args) {
System.out.println("Hello! I'm Duke");
System.out.println("What can I do for you?");
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();
Duke bot = new Duke();
//int counter = 1;

while(!(input.equals("bye"))) {
if (input.equals("list")) {
bot.printList();
}else{
String command = input.split(" ")[0];
if(command.equals("done")){
int id = Integer.valueOf(input.split(" ")[1]);
bot.markTaskAsDone(id);

}else if(command.equals("todo")) {
input = input.split(" ",2)[1];
ToDo newTask = new ToDo(input);
bot.addToList(newTask);
//counter++;
}else if(command.equals("event")){
input = input.split(" ",2)[1];
String content = input.split("/at")[0];
String at = input.split("/at")[1];
Event newTask = new Event(content,at);
bot.addToList(newTask);
}else{
input = input.split(" ",2)[1];
String content = input.split("/by")[0];
String by= input.split("/by")[1];
Deadline newTask = new Deadline(content,by);
bot.addToList(newTask);
}

}
input = sc.nextLine();
}

System.out.println("Bye. Hope to see you again soon!");
}
}
59 changes: 59 additions & 0 deletions src/main/java/Level_5.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import java.util.*;

public class Level_5 {
public static void main(String[] args) throws DukeException {
System.out.println("Hello! I'm Duke");
System.out.println("What can I do for you?");
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();
Duke bot = new Duke();
//int counter = 1;

while (!(input.equals("bye"))) {
if (input.equals("list")) {
bot.printList();
} else {
String command = input.split(" ")[0];
try {
if (command.equals("done")) {
int id = Integer.valueOf(input.split(" ")[1]);
bot.markTaskAsDone(id);

} else if (command.equals("todo")) {
try {
input = input.split(" ", 2)[1];
ToDo newTask = new ToDo(input);
bot.addToList(newTask);
//counter++;
} catch (Exception e) {
throw new DukeException(("OOPS!!! The description cannot be empty."));
}
} else if (command.equals("event")) {
input = input.split(" ", 2)[1];
String content = input.split("/at")[0];
String at = input.split("/at")[1];
Event newTask = new Event(content, at);
bot.addToList(newTask);
} else if (command.equals("deadline")) {
input = input.split(" ", 2)[1];
String content = input.split("/by")[0];
String by = input.split("/by")[1];
Deadline newTask = new Deadline(content, by);
bot.addToList(newTask);
} else {
throw new DukeException("OOPS!!! I'm sorry, but I don't know what that means :-{");
}
} catch (DukeException e1) {
System.out.println(e1);

}
}

input = sc.nextLine();
}


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

65 changes: 65 additions & 0 deletions src/main/java/Level_6.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import java.util.*;

public class Level_6 {
public static void main(String[] args) throws DukeException {
System.out.println("Hello! I'm Duke");
System.out.println("What can I do for you?");
Scanner sc = new Scanner(System.in);
String input = sc.nextLine();
Duke bot = new Duke();
//int counter = 1;

while (!(input.equals("bye"))) {
if (input.equals("list")) {
bot.printList();
} else {
String command = input.split(" ")[0];
try {
if (command.equals("done")) {
int id = Integer.valueOf(input.split(" ")[1]);
bot.markTaskAsDone(id);

} else if (command.equals("todo")) {
try {
input = input.split(" ", 2)[1];
ToDo newTask = new ToDo(input);
bot.addToList(newTask);
//counter++;
} catch (Exception e) {
throw new DukeException(("OOPS!!! The description cannot be empty."));
}
} else if (command.equals("event")) {
input = input.split(" ", 2)[1];
String content = input.split("/at")[0];
String at = input.split("/at")[1];
Event newTask = new Event(content, at);
bot.addToList(newTask);
} else if (command.equals("deadline")) {
input = input.split(" ", 2)[1];
String content = input.split("/by")[0];
String by = input.split("/by")[1];
Deadline newTask = new Deadline(content, by);
bot.addToList(newTask);
}else if(command.equals("delete")){
int id = Integer.valueOf(input.split(" ")[1]);
bot.deleteTask(id);

} else {
throw new DukeException("OOPS!!! I'm sorry, but I don't know what that means :-{");
}
} catch (DukeException e1) {
System.out.println(e1);

}
}

input = sc.nextLine();
}


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



Loading