Skip to content

Commit

Permalink
Merge pull request #7 from ryanlohyr/ryan-createLayout
Browse files Browse the repository at this point in the history
Create project base layout
  • Loading branch information
ryanlohyr authored Oct 12, 2023
2 parents 526e698 + de707c3 commit 5277248
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 12 deletions.
17 changes: 5 additions & 12 deletions src/main/java/seedu/duke/Duke.java
Original file line number Diff line number Diff line change
@@ -1,21 +1,14 @@
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());
}

}
40 changes: 40 additions & 0 deletions src/main/java/seedu/duke/controllers/ModulePlannerController.java
Original file line number Diff line number Diff line change
@@ -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("Hello " + userInput);
break;
}

}
userInput = in.nextLine();
}
}
}
2 changes: 2 additions & 0 deletions src/main/java/seedu/duke/models/Duke.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CS1010S
MA1508
4 changes: 4 additions & 0 deletions src/main/java/seedu/duke/models/Module.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package seedu.duke.models;
public class Module {
//defining your module object etc
}
18 changes: 18 additions & 0 deletions src/main/java/seedu/duke/views/CommandLineView.java
Original file line number Diff line number Diff line change
@@ -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);
}

}

0 comments on commit 5277248

Please sign in to comment.