diff --git a/.gitignore b/.gitignore index 1ec2dd904..5f79b1afe 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,4 @@ text-ui-test/EXPECTED-UNIX.TXT # week2 level-0 *.class + diff --git a/src/main/java/Deadline.java b/src/main/java/Deadline.java deleted file mode 100644 index 2bdb31187..000000000 --- a/src/main/java/Deadline.java +++ /dev/null @@ -1,12 +0,0 @@ -public class Deadline extends Task{ - private String by; - public Deadline(String description, String by) { - super(description); - this.by = by; - } - - @Override - public String toString(){ - return "[D]" + super.toString() + " (by: " + this.by + ")"; - } -} diff --git a/src/main/java/Duke.java b/src/main/java/Duke.java deleted file mode 100644 index 8410042fb..000000000 --- a/src/main/java/Duke.java +++ /dev/null @@ -1,129 +0,0 @@ -import java.util.Scanner; - -public class Duke { - static int limitTask = 100; - static Task[] tasks = new Task[limitTask]; - static int taskCount = 0; - - - - public static void listTask(){ - int idxCount = 1; - printHorizontalLine(); - System.out.println("Here are the tasks in your list:"); - for (int i = 0 ; i < taskCount; i++){ - System.out.println(idxCount + "." + tasks[i].toString()); - idxCount++; - } - printHorizontalLine(); - } - public static void addTask(String input, String taskType){ - if(taskCount == limitTask ) { - printHorizontalLine(); - System.out.println("Too much tasks"); - printHorizontalLine(); - return; - } - - String task; - int firstSpaceAfterTaskType,firstSlashSeparator,secondSlashSeparator; - - switch (taskType){ - case "todo": - //ex: todo read book - firstSpaceAfterTaskType = input.indexOf(" "); - task = input.substring(firstSpaceAfterTaskType + 1); - tasks[taskCount] = new Todo(task); - break; - - case "deadline": - //ex: deadline return book /by 2pm - firstSpaceAfterTaskType = input.indexOf(" "); - firstSlashSeparator = input.indexOf('/'); - - task = input.substring(firstSpaceAfterTaskType + 1,firstSlashSeparator - 1); - String by = input.substring(input.indexOf("/") + 4); - tasks[taskCount] = new Deadline(task,by); - break; - - case "event": - //event meeting /from 2pm /to 4pm - firstSpaceAfterTaskType = input.indexOf(" "); - firstSlashSeparator = input.indexOf('/'); - secondSlashSeparator = input.indexOf('/',input.indexOf('/') + 1); - - task = input.substring(firstSpaceAfterTaskType + 1,firstSlashSeparator - 1); - String from = input.substring(firstSlashSeparator + 6, secondSlashSeparator - 1); - String to = input.substring(secondSlashSeparator + 4); - tasks[taskCount] = new Event(task, from, to); - break; - } - - printHorizontalLine(); - System.out.println("Got it. I've added this task:\n" + tasks[taskCount].toString() + - "\nNow you have " + (taskCount + 1) + " in the list"); - printHorizontalLine(); - taskCount++; - } - - - public static void markTask(int index){ - if(index < taskCount && index >=0){ - tasks[index].markAsDone(); - printHorizontalLine(); - System.out.println("Nice! I've marked this task as done:"); - System.out.println(tasks[index].toString()); - printHorizontalLine(); - } - } - - public static void unmarkTask(int index){ - if(index < taskCount && index >=0){ - tasks[index].markAsNotDone(); - printHorizontalLine(); - System.out.println("OK, I've marked this task as not done yet:"); - System.out.println(tasks[index].toString()); - printHorizontalLine(); - } - } - public static void startBot(){ - Scanner in = new Scanner((System.in)); - while(true){ - String input = in.nextLine(); - String[] args = input.split(" "); - int index; - switch(args[0]){ - case "bye": - return; - case "list": - listTask(); - break; - case "mark": - index = Integer.parseInt(args[1]) - 1; - markTask(index); - break; - case "unmark": - index = Integer.parseInt(args[1]) - 1; - unmarkTask(index); - break; - default: - addTask(input,args[0]); - - } - } - } - public static void main(String[] args) { - printHorizontalLine(); - System.out.println( "Hello! I'm Duke\n" + " What can I do for you?\n"); - printHorizontalLine(); - - startBot(); - - printHorizontalLine(); - System.out.println(" Bye. Hope to see you again soon!\n"); - printHorizontalLine(); - } - public static void printHorizontalLine(){ - System.out.println("____________________________________________________________"); - } -} diff --git a/src/main/java/Event.java b/src/main/java/Event.java deleted file mode 100644 index cd3e55737..000000000 --- a/src/main/java/Event.java +++ /dev/null @@ -1,13 +0,0 @@ -public class Event extends Task { - private String from, 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: " + this.from + " to: " + this.to +")"; - } -} diff --git a/src/main/java/META-INF/MANIFEST.MF b/src/main/java/META-INF/MANIFEST.MF new file mode 100644 index 000000000..2c6354be6 --- /dev/null +++ b/src/main/java/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Main-Class: duke.main.Duke + diff --git a/src/main/java/Task.java b/src/main/java/Task.java deleted file mode 100644 index f807906bc..000000000 --- a/src/main/java/Task.java +++ /dev/null @@ -1,27 +0,0 @@ -public class Task { - private String description; - private boolean isDone; - - public Task(String description) { - this.description = description; - this.isDone = false; - } - - public String getStatusIcon() { - return (isDone ? "X" : " "); // mark done task with X - } - public void markAsDone(){ - this.isDone = true; - } - public void markAsNotDone(){ - this.isDone = false; - } - public String getDescription(){ - return this.description; - } - - @Override - public String toString(){ - return "[" + this.getStatusIcon() + "] " + this.description; - } -} \ No newline at end of file diff --git a/src/main/java/Todo.java b/src/main/java/Todo.java deleted file mode 100644 index 149e09870..000000000 --- a/src/main/java/Todo.java +++ /dev/null @@ -1,10 +0,0 @@ -public class Todo extends Task { - public Todo(String description) { - super(description); - } - - @Override - public String toString(){ - return "[T]" + super.toString(); - } -}