From f7df8565f0f1c09b3e97078aa0914ec8c8beb51e Mon Sep 17 00:00:00 2001 From: ryanlohyr Date: Thu, 12 Oct 2023 22:54:41 +0800 Subject: [PATCH 1/4] create project base layout --- src/main/java/seedu/duke/Duke.java | 16 ++------ .../controllers/ModulePlannerController.java | 40 +++++++++++++++++++ src/main/java/seedu/duke/models/Duke.txt | 2 + src/main/java/seedu/duke/models/Module.java | 4 ++ .../seedu/duke/views/CommandLineView.java | 18 +++++++++ 5 files changed, 68 insertions(+), 12 deletions(-) create mode 100644 src/main/java/seedu/duke/controllers/ModulePlannerController.java create mode 100644 src/main/java/seedu/duke/models/Duke.txt create mode 100644 src/main/java/seedu/duke/models/Module.java create mode 100644 src/main/java/seedu/duke/views/CommandLineView.java diff --git a/src/main/java/seedu/duke/Duke.java b/src/main/java/seedu/duke/Duke.java index 5c74e68d59..de4c20a902 100644 --- a/src/main/java/seedu/duke/Duke.java +++ b/src/main/java/seedu/duke/Duke.java @@ -1,21 +1,13 @@ package seedu.duke; - -import java.util.Scanner; - +import seedu.duke.controllers.ModulePlannerController; public class Duke { /** * Main entry-point for the java.duke.Duke application. */ + //main should have basically no code except start public static void main(String[] args) { - String logo = " ____ _ \n" - + "| _ \\ _ _| | _____ \n" - + "| | | | | | | |/ / _ \\\n" - + "| |_| | |_| | < __/\n" - + "|____/ \\__,_|_|\\_\\___|\n"; - System.out.println("Hello from\n" + logo); - System.out.println("What is your name?"); + ModulePlannerController controller = new ModulePlannerController(); + controller.start(); - Scanner in = new Scanner(System.in); - System.out.println("Hello " + in.nextLine()); } } diff --git a/src/main/java/seedu/duke/controllers/ModulePlannerController.java b/src/main/java/seedu/duke/controllers/ModulePlannerController.java new file mode 100644 index 0000000000..8d0d0b0415 --- /dev/null +++ b/src/main/java/seedu/duke/controllers/ModulePlannerController.java @@ -0,0 +1,40 @@ +package seedu.duke.controllers; +import seedu.duke.views.CommandLineView; + +import java.util.Scanner; + +public class ModulePlannerController { + private CommandLineView view; + public ModulePlannerController(){ + this.view = new CommandLineView(); + } + public void start(){ + view.displayWelcome(); + Scanner in = new Scanner(System.in); + String userInput = in.nextLine(); + + while(!userInput.equals("Bye")){ + + String[] words = userInput.split(" "); + + String initialWord = words[0]; + + switch(initialWord){ + case "hi":{ + view.displayMessage("can put the commands here"); + break; + } + case "hello":{ + view.displayMessage("yup"); + break; + } + default:{ + view.displayMessage("Invalid Input"); + break; + } + + } + userInput = in.nextLine(); + } + } +} diff --git a/src/main/java/seedu/duke/models/Duke.txt b/src/main/java/seedu/duke/models/Duke.txt new file mode 100644 index 0000000000..5d8266cc98 --- /dev/null +++ b/src/main/java/seedu/duke/models/Duke.txt @@ -0,0 +1,2 @@ +CS1010S +MA1508 \ No newline at end of file diff --git a/src/main/java/seedu/duke/models/Module.java b/src/main/java/seedu/duke/models/Module.java new file mode 100644 index 0000000000..b27279233b --- /dev/null +++ b/src/main/java/seedu/duke/models/Module.java @@ -0,0 +1,4 @@ +package seedu.duke.models; +public class Module { + //defining your module object etc +} diff --git a/src/main/java/seedu/duke/views/CommandLineView.java b/src/main/java/seedu/duke/views/CommandLineView.java new file mode 100644 index 0000000000..d881b8a75a --- /dev/null +++ b/src/main/java/seedu/duke/views/CommandLineView.java @@ -0,0 +1,18 @@ +package seedu.duke.views; + +public class CommandLineView { + public void displayWelcome(){ + String logo = " ____ _ \n" + + "| _ \\ _ _| | _____ \n" + + "| | | | | | | |/ / _ \\\n" + + "| |_| | |_| | < __/\n" + + "|____/ \\__,_|_|\\_\\___|\n"; + System.out.println("Hello from\n" + logo); + System.out.println("What is your name?"); + } + + public void displayMessage(String message) { + System.out.println(message); + } + +} From 448ac15a82ee8f25745d15ad226d9a5dd0f6bc55 Mon Sep 17 00:00:00 2001 From: ryanlohyr Date: Thu, 12 Oct 2023 22:59:54 +0800 Subject: [PATCH 2/4] Create base project layout --- src/main/java/seedu/duke/Duke.java | 16 ++------ .../controllers/ModulePlannerController.java | 40 +++++++++++++++++++ src/main/java/seedu/duke/models/Duke.txt | 2 + src/main/java/seedu/duke/models/Module.java | 4 ++ .../seedu/duke/views/CommandLineView.java | 18 +++++++++ 5 files changed, 68 insertions(+), 12 deletions(-) create mode 100644 src/main/java/seedu/duke/controllers/ModulePlannerController.java create mode 100644 src/main/java/seedu/duke/models/Duke.txt create mode 100644 src/main/java/seedu/duke/models/Module.java create mode 100644 src/main/java/seedu/duke/views/CommandLineView.java diff --git a/src/main/java/seedu/duke/Duke.java b/src/main/java/seedu/duke/Duke.java index 5c74e68d59..de4c20a902 100644 --- a/src/main/java/seedu/duke/Duke.java +++ b/src/main/java/seedu/duke/Duke.java @@ -1,21 +1,13 @@ package seedu.duke; - -import java.util.Scanner; - +import seedu.duke.controllers.ModulePlannerController; public class Duke { /** * Main entry-point for the java.duke.Duke application. */ + //main should have basically no code except start public static void main(String[] args) { - String logo = " ____ _ \n" - + "| _ \\ _ _| | _____ \n" - + "| | | | | | | |/ / _ \\\n" - + "| |_| | |_| | < __/\n" - + "|____/ \\__,_|_|\\_\\___|\n"; - System.out.println("Hello from\n" + logo); - System.out.println("What is your name?"); + ModulePlannerController controller = new ModulePlannerController(); + controller.start(); - Scanner in = new Scanner(System.in); - System.out.println("Hello " + in.nextLine()); } } diff --git a/src/main/java/seedu/duke/controllers/ModulePlannerController.java b/src/main/java/seedu/duke/controllers/ModulePlannerController.java new file mode 100644 index 0000000000..8d0d0b0415 --- /dev/null +++ b/src/main/java/seedu/duke/controllers/ModulePlannerController.java @@ -0,0 +1,40 @@ +package seedu.duke.controllers; +import seedu.duke.views.CommandLineView; + +import java.util.Scanner; + +public class ModulePlannerController { + private CommandLineView view; + public ModulePlannerController(){ + this.view = new CommandLineView(); + } + public void start(){ + view.displayWelcome(); + Scanner in = new Scanner(System.in); + String userInput = in.nextLine(); + + while(!userInput.equals("Bye")){ + + String[] words = userInput.split(" "); + + String initialWord = words[0]; + + switch(initialWord){ + case "hi":{ + view.displayMessage("can put the commands here"); + break; + } + case "hello":{ + view.displayMessage("yup"); + break; + } + default:{ + view.displayMessage("Invalid Input"); + break; + } + + } + userInput = in.nextLine(); + } + } +} diff --git a/src/main/java/seedu/duke/models/Duke.txt b/src/main/java/seedu/duke/models/Duke.txt new file mode 100644 index 0000000000..5d8266cc98 --- /dev/null +++ b/src/main/java/seedu/duke/models/Duke.txt @@ -0,0 +1,2 @@ +CS1010S +MA1508 \ No newline at end of file diff --git a/src/main/java/seedu/duke/models/Module.java b/src/main/java/seedu/duke/models/Module.java new file mode 100644 index 0000000000..b27279233b --- /dev/null +++ b/src/main/java/seedu/duke/models/Module.java @@ -0,0 +1,4 @@ +package seedu.duke.models; +public class Module { + //defining your module object etc +} diff --git a/src/main/java/seedu/duke/views/CommandLineView.java b/src/main/java/seedu/duke/views/CommandLineView.java new file mode 100644 index 0000000000..d881b8a75a --- /dev/null +++ b/src/main/java/seedu/duke/views/CommandLineView.java @@ -0,0 +1,18 @@ +package seedu.duke.views; + +public class CommandLineView { + public void displayWelcome(){ + String logo = " ____ _ \n" + + "| _ \\ _ _| | _____ \n" + + "| | | | | | | |/ / _ \\\n" + + "| |_| | |_| | < __/\n" + + "|____/ \\__,_|_|\\_\\___|\n"; + System.out.println("Hello from\n" + logo); + System.out.println("What is your name?"); + } + + public void displayMessage(String message) { + System.out.println(message); + } + +} From 9bddadace6b3fe56ea34260bfbf808a576b7e336 Mon Sep 17 00:00:00 2001 From: ryanlohyr Date: Thu, 12 Oct 2023 23:02:13 +0800 Subject: [PATCH 3/4] Revert "Create base project layout" This reverts commit 448ac15a82ee8f25745d15ad226d9a5dd0f6bc55. --- src/main/java/seedu/duke/Duke.java | 16 ++++++-- .../controllers/ModulePlannerController.java | 40 ------------------- src/main/java/seedu/duke/models/Duke.txt | 2 - src/main/java/seedu/duke/models/Module.java | 4 -- .../seedu/duke/views/CommandLineView.java | 18 --------- 5 files changed, 12 insertions(+), 68 deletions(-) delete mode 100644 src/main/java/seedu/duke/controllers/ModulePlannerController.java delete mode 100644 src/main/java/seedu/duke/models/Duke.txt delete mode 100644 src/main/java/seedu/duke/models/Module.java delete mode 100644 src/main/java/seedu/duke/views/CommandLineView.java diff --git a/src/main/java/seedu/duke/Duke.java b/src/main/java/seedu/duke/Duke.java index de4c20a902..5c74e68d59 100644 --- a/src/main/java/seedu/duke/Duke.java +++ b/src/main/java/seedu/duke/Duke.java @@ -1,13 +1,21 @@ package seedu.duke; -import seedu.duke.controllers.ModulePlannerController; + +import java.util.Scanner; + public class Duke { /** * Main entry-point for the java.duke.Duke application. */ - //main should have basically no code except start public static void main(String[] args) { - ModulePlannerController controller = new ModulePlannerController(); - controller.start(); + String logo = " ____ _ \n" + + "| _ \\ _ _| | _____ \n" + + "| | | | | | | |/ / _ \\\n" + + "| |_| | |_| | < __/\n" + + "|____/ \\__,_|_|\\_\\___|\n"; + System.out.println("Hello from\n" + logo); + System.out.println("What is your name?"); + Scanner in = new Scanner(System.in); + System.out.println("Hello " + in.nextLine()); } } diff --git a/src/main/java/seedu/duke/controllers/ModulePlannerController.java b/src/main/java/seedu/duke/controllers/ModulePlannerController.java deleted file mode 100644 index 8d0d0b0415..0000000000 --- a/src/main/java/seedu/duke/controllers/ModulePlannerController.java +++ /dev/null @@ -1,40 +0,0 @@ -package seedu.duke.controllers; -import seedu.duke.views.CommandLineView; - -import java.util.Scanner; - -public class ModulePlannerController { - private CommandLineView view; - public ModulePlannerController(){ - this.view = new CommandLineView(); - } - public void start(){ - view.displayWelcome(); - Scanner in = new Scanner(System.in); - String userInput = in.nextLine(); - - while(!userInput.equals("Bye")){ - - String[] words = userInput.split(" "); - - String initialWord = words[0]; - - switch(initialWord){ - case "hi":{ - view.displayMessage("can put the commands here"); - break; - } - case "hello":{ - view.displayMessage("yup"); - break; - } - default:{ - view.displayMessage("Invalid Input"); - break; - } - - } - userInput = in.nextLine(); - } - } -} diff --git a/src/main/java/seedu/duke/models/Duke.txt b/src/main/java/seedu/duke/models/Duke.txt deleted file mode 100644 index 5d8266cc98..0000000000 --- a/src/main/java/seedu/duke/models/Duke.txt +++ /dev/null @@ -1,2 +0,0 @@ -CS1010S -MA1508 \ No newline at end of file diff --git a/src/main/java/seedu/duke/models/Module.java b/src/main/java/seedu/duke/models/Module.java deleted file mode 100644 index b27279233b..0000000000 --- a/src/main/java/seedu/duke/models/Module.java +++ /dev/null @@ -1,4 +0,0 @@ -package seedu.duke.models; -public class Module { - //defining your module object etc -} diff --git a/src/main/java/seedu/duke/views/CommandLineView.java b/src/main/java/seedu/duke/views/CommandLineView.java deleted file mode 100644 index d881b8a75a..0000000000 --- a/src/main/java/seedu/duke/views/CommandLineView.java +++ /dev/null @@ -1,18 +0,0 @@ -package seedu.duke.views; - -public class CommandLineView { - public void displayWelcome(){ - String logo = " ____ _ \n" - + "| _ \\ _ _| | _____ \n" - + "| | | | | | | |/ / _ \\\n" - + "| |_| | |_| | < __/\n" - + "|____/ \\__,_|_|\\_\\___|\n"; - System.out.println("Hello from\n" + logo); - System.out.println("What is your name?"); - } - - public void displayMessage(String message) { - System.out.println(message); - } - -} From de707c380d524d5b537fa700b0bd3337eb46c778 Mon Sep 17 00:00:00 2001 From: ryanlohyr Date: Thu, 12 Oct 2023 23:24:49 +0800 Subject: [PATCH 4/4] Fix test bug --- src/main/java/seedu/duke/Duke.java | 1 + .../java/seedu/duke/controllers/ModulePlannerController.java | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/java/seedu/duke/Duke.java b/src/main/java/seedu/duke/Duke.java index de4c20a902..90a50d62a9 100644 --- a/src/main/java/seedu/duke/Duke.java +++ b/src/main/java/seedu/duke/Duke.java @@ -10,4 +10,5 @@ public static void main(String[] args) { controller.start(); } + } diff --git a/src/main/java/seedu/duke/controllers/ModulePlannerController.java b/src/main/java/seedu/duke/controllers/ModulePlannerController.java index 8d0d0b0415..902074d70a 100644 --- a/src/main/java/seedu/duke/controllers/ModulePlannerController.java +++ b/src/main/java/seedu/duke/controllers/ModulePlannerController.java @@ -29,7 +29,7 @@ public void start(){ break; } default:{ - view.displayMessage("Invalid Input"); + view.displayMessage("Hello " + userInput); break; }