-
Notifications
You must be signed in to change notification settings - Fork 92
Expand file tree
/
Copy pathMoodPredictor.java
More file actions
31 lines (26 loc) · 1 KB
/
MoodPredictor.java
File metadata and controls
31 lines (26 loc) · 1 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
import java.util.*;
public class MoodPredictor {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);
System.out.println("🌞 Welcome to Mood Predictor 🌞");
System.out.print("Enter your name: ");
String name = sc.nextLine();
String[] moods = {
"Happy 😊",
"Sad 😔",
"Excited 🤩",
"Stressed 😣",
"Peaceful 😌",
"Energetic ⚡",
"Lazy 😴",
"Motivated 🚀"
};
// Use current time + name hash to make it feel more "personal"
int hash = Math.abs((name.hashCode() + Calendar.getInstance().get(Calendar.MINUTE)) % moods.length);
String mood = moods[hash];
System.out.println("\nHello " + name + "!");
System.out.println("Today, your mood prediction is: " + mood);
System.out.println("\nTip: Remember, your mood is what you make it. Stay positive! 🌈");
sc.close();
}
}