Skip to content

Commit e5b6dbf

Browse files
committed
Interpreter Design Pattern - Artificial Intelligence Chat Bot
Checked in client file
1 parent 6deb6b9 commit e5b6dbf

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
11
package com.premaseem;
22

3+
import java.util.Scanner;
4+
35
/*
46
@author: Aseem Jain
57
@title: Design Patterns with Java 9
68
@link: https://premaseem.wordpress.com/category/computers/design-patterns/
7-
@copyright: 2018 Packt Publication
89
*/
910
public class Client {
1011
public static void main (String[] args) {
11-
System.out.println("Singleton cook example ");
12+
System.out.println("Alexa welcomes you to Artificial intelligence app designed using Interpreter Design pattern :-) ");
13+
Scanner scanner = new Scanner(System.in);
14+
15+
// User input block
16+
String repeatRunFlag = "yes";
17+
while (!repeatRunFlag.equalsIgnoreCase("no")) {
18+
System.out.println("\n Please ask your question related to voting ...");
19+
String question = scanner.nextLine();
20+
Boolean result =true;
21+
String voteEligible = result ? "Yes ! can vote :-) ":"No ! cannot vote :-)";
22+
23+
System.out.println("Alexa answered: " + voteEligible);
24+
System.out.println("Do you have another questions ? yes / no ");
25+
repeatRunFlag = scanner.next();
26+
}
1227
}
1328
}

0 commit comments

Comments
 (0)