Skip to content
This repository has been archived by the owner on Mar 16, 2020. It is now read-only.

Commit

Permalink
Implement level 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Parcly-Taxel committed Aug 16, 2019
1 parent baa18a5 commit 47c53ed
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Class files
*.class

# IDEA files
/.idea/
/out/
Expand Down
29 changes: 23 additions & 6 deletions src/main/java/Duke.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
import java.util.Scanner;

public class Duke {
//@@author Parcly-Taxel
/**
* Pretty-prints a line of prompt to the user.
*/
public static void printPrompt(String prompt) {
System.out.println(" " + prompt);
}

public static void main(String[] args) {
String logo = " ____ _ \n"
+ "| _ \\ _ _| | _____ \n"
+ "| | | | | | | |/ / _ \\\n"
+ "| |_| | |_| | < __/\n"
+ "|____/ \\__,_|_|\\_\\___|\n";
System.out.println("Hello from\n" + logo);
Scanner sc = new Scanner(System.in);
printPrompt("Hello! I'm Duke");
printPrompt("What can I do for you?");

while (true) {
String cmd = sc.nextLine();
if (cmd.equals("bye")) {
break;
}
printPrompt(cmd);
}

printPrompt("Bye. Hope to see you again soon!");
}
}

0 comments on commit 47c53ed

Please sign in to comment.