Skip to content

Commit

Permalink
Level-1: Greet, Echo, Exit
Browse files Browse the repository at this point in the history
  • Loading branch information
gx-huang committed Jan 21, 2020
1 parent bb1d7a8 commit dc61d37
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/main/java/Duke.java
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import java.util.Scanner;

public class Duke {
public static void main(String[] args) {
String logo = " ____ _ \n"
Expand All @@ -6,5 +8,22 @@ public static void main(String[] args) {
+ "| |_| | |_| | < __/\n"
+ "|____/ \\__,_|_|\\_\\___|\n";
System.out.println("Hello from\n" + logo);
System.out.println("What can i do for you?");

Scanner input = new Scanner(System.in);

boolean isListening = true;
while(isListening) {
String command = input.nextLine();

if (command.equals("bye")) {
System.out.println("Bye. Hope to see you again soon!");
isListening = false;
}

else {
System.out.println(command);
}
}
}
}

0 comments on commit dc61d37

Please sign in to comment.