-
Notifications
You must be signed in to change notification settings - Fork 0
/
Deena.java
210 lines (161 loc) · 4.24 KB
/
Deena.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
import java.io.*;
public class deena
{
public static void main(String args[])throws IOException
{
int fact=1,n,s=0,y=0,to_day=0,da_te=0,l;
String a=" ",b,c,d,g,str;
char t;
System.out.println("Hi there! I am Deena");
System.out.println("what's your name?(only the name please)");
BufferedReader br= new BufferedReader(new InputStreamReader(System.in));
a=br.readLine();
System.out.println("Hello "+a);
System.out.println("so how are you?");
/*need to put something so that deena should not wait for an interrupt
*and after that it should directly jump to ask
*users the date and their date of birth
*/
switch(str=(String)br.readLine())
{
case "fine":
case "i am fine":
System.out.println("good to know");
break;
case "okay":
case "i am okay":
System.out.println("that's good");
break;
case "good":
case "i am good":
System.out.println("well then let us talk a bit");
break;
case "better":
case "i am better":
System.out.println("okay nice then!");
break;
case "nice":
case "i am nice":
System.out.println("as expected, but glad to know");
break;
default:
System.out.println("???what do you mean");
}
try{
c=br.readLine();
}
catch(Exception e)
{
System.out.println("well in case when you had press enter then i wouldn't have become sick!!");
}
System.out.println("What is the date today");
try{
to_day=Integer.parseInt(br.readLine());
}
catch(Exception e)
{
System.out.println("while entering the date plz dont mention the month and the year");
System.out.println("so tell me the date now");
l=Integer.parseInt(br.readLine());
}
System.out.println("lets talk about your birthday");
System.out.println("please enter the date of your birth but dont give me the month and year");
da_te=Integer.parseInt(br.readLine());
if(da_te==to_day)
{
System.out.println("hey dear today is your birthday");
System.out.println("HAPPY BITHDAY DEAR "+a);
}
else
{
System.out.println("oh so we have to wait for your birhtday");
}
System.out.flush();
d=br.readLine();
System.out.println("hey! do you want some more ");
g=br.readLine();
System.out.println("\n So I have a list of things that i can do for you ");
if(s==y)
{
System.out.println("1..fibonacci series");
System.out.println("2..A joke");
System.out.println("3..check palindrome or not");
System.out.println("4..about myself");
System.out.println( "5..five great signs of an intelligent being");
System.out.println( "6..find factorial of a number");
}
else
{
System.out.println("what would you like then?");
}
try{
switch( t=(char)System.in.read())
{
case '1':
int o=1,p=1,r=0;
System.out.print("1 1 ");
do{
r=o+p;
System.out.print(r+" ");
o=p;
p=r;
}while(r<=50);
break;
case '2': System.out.println("what did an ant say to an Elephant that made him cry?");
System.out.println("that I ate your bananas!!!");
break;
case '3':
int w=0;
int rem,num=w,sum=0;
System.out.print("enter the number to check for palindrome");
int v=Integer.parseInt(br.readLine());
while(num!=0)
{
rem=num%10;
num=num/10;
sum=sum*10+rem;
System.out.println(""+sum);
}
if(sum==num)
{
System.out.println("the number is a palindrome number");
}
else
{
System.out.println("the number is not a palindrome");
}
break;
case '4':
System.out.println("I am a baby digital assistant made to help you do things");
System.out.println("I am yet to develope more and eager to be a part of the Artificial Intelligence world");
break;
case '5':
System.out.println("These are.............");
System.out.println("They are always optimistic");
System.out.println("They think out of the box");
System.out.println("They are never afraid of taking risks");
System.out.println("They work for the good for society and to help make this world a better place");
System.out.println("They work smarter and innovatively");
break;
case '6':
System.out.println("enter the number to find factorial");
n=Integer.parseInt(br.readLine());
do
{
fact=fact*n;
n--;
}
while(n>=1);
System.out.println("factorial is "+fact);
break;
default:
System.out.println("sorry! at this time i can do only the above mentioned things in the list");
int dem=Integer.parseInt(br.readLine());
}
}
catch(Exception e)
{
System.out.println("oh no a major error is disturbing me!I have to go sorry :(");
}
}
}