Skip to content

Commit

Permalink
Update Duke.java
Browse files Browse the repository at this point in the history
Add echo for commands
  • Loading branch information
rgonslayer committed Aug 24, 2022
1 parent e698798 commit df2fe72
Showing 1 changed file with 22 additions and 6 deletions.
28 changes: 22 additions & 6 deletions src/main/java/Duke.java
Original file line number Diff line number Diff line change
@@ -1,10 +1,26 @@
import java.util.Scanner;

public class Duke {
public static void main(String[] args) {
String logo = " ____ _ \n"
+ "| _ \\ _ _| | _____ \n"
+ "| | | | | | | |/ / _ \\\n"
+ "| |_| | |_| | < __/\n"
+ "|____/ \\__,_|_|\\_\\___|\n";
System.out.println("Hello from\n" + logo);
Scanner inputScanner = new Scanner(System.in);

String nextInstruction;
String introduction = "Hello! I'm Jarvis \n"
+ "What can I do for you?";
String farewell = "Bye. Hope to see you again soon!";

System.out.println(introduction);

while (true) {
nextInstruction = inputScanner.nextLine();
if (nextInstruction.equals("bye")) {
break;
}
System.out.println(nextInstruction);
}

System.out.println(farewell);


}
}

0 comments on commit df2fe72

Please sign in to comment.