This repository has been archived by the owner on Mar 16, 2020. It is now read-only.
forked from nus-cs2103-AY1920S1/duke
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
baa18a5
commit 47c53ed
Showing
2 changed files
with
26 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
# Class files | ||
*.class | ||
|
||
# IDEA files | ||
/.idea/ | ||
/out/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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!"); | ||
} | ||
} |