-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPersonalAssistant.java
More file actions
78 lines (57 loc) · 1.76 KB
/
PersonalAssistant.java
File metadata and controls
78 lines (57 loc) · 1.76 KB
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
import java.util.Scanner;
public class PersonalAssistant{
public static void main(String[] args){
Scanner input = new Scanner(System.in);
Scanner input2 = new Scanner(System.in);
System.out.print("Enter your name: ");
String name = input.nextLine();
System.out.print("Enter your age: ");
int age = input.nextInt();
System.out.print("How are you feeling(happy,sad,excited,tired) today?");
String feeling = input2.nextLine();
System.out.print("Guess any number between 1 - 10: ");
int number = input.nextInt();
System.out.print("Do you want a suggestion (yes/no)? ");
String suggestion = input.next();
if(age < 13){
System.out.printf("Hello %s, You are a young explorer!%n",name);
}
else if(age <= 13 && age <= 19){
System.out.printf("Hello %s, Teen life is fun! enjoy it!%n",name);
}
else if(age <= 20 && age <= 59){
System.out.printf("Hello %s, Adulting can be challenging, stay strong!%n", name);
}
else if(age <= 60){
System.out.printf("Hello %s, Wisdom looks good on you!%n", name);
}
else{
System.out.printf("Hello %s, Go and marry!%n", name);
}
switch(feeling){
case "happy":
System.out.println(" keep smiling!"); break;
case "sad":
System.out.println(" Cheer up! tommorow is a new day!"); break;
case "excited":
System.out.println("Awesome! enjoy your energy!"); break;
case "tired":
System.out.println("Rest well and recharge!"); break;
default :
System.out.println(" Go and drink beer!");
}
int guess = (int)(Math.random()*10);
if(number == guess){
System.out.print("You are correct my friend!");
}
else{
System.out.print("You are wrong!");
}
switch(suggestion){
case "yes" :
System.out.print("Go out and have fun!"); break;
default:
System.out.print("Have a great day anyways!");
}
}
}