File tree Expand file tree Collapse file tree
pattern/src/com/premaseem Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11package 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*/
910public 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}
You can’t perform that action at this time.
0 commit comments