An interactive command-line application that simulates a mental health check-in assistant โ track your mood, practice guided breathing exercises, and receive motivational quotes to brighten your day.
Mental Health Simulation is a Java-based console application designed to promote mental wellness through interactive self-care sessions. The program acts as a virtual mental health assistant that guides users through mood check-ins, provides motivational quotes from renowned thought leaders, and offers guided breathing exercises to help manage stress and anxiety.
This project demonstrates core Object-Oriented Programming (OOP) concepts in Java โ including encapsulation, composition, and modular class design โ while addressing a meaningful real-world topic: mental health awareness.
| Feature | Description |
|---|---|
| ๐ญ Mood Tracking | Log your current mood from options like Happy, Sad, Anxious, Angry, Tired, Excited, or Okay |
| ๐ Mood History | View a complete history of all your logged moods across sessions |
| ๐ง Guided Breathing Exercise | Follow a timed 3-round breathing exercise (Breathe In โ Hold โ Breathe Out) with real-time prompts |
| ๐ฌ Motivational Quotes | Receive randomly selected inspirational quotes from leaders like Nelson Mandela, Albert Einstein, and more |
| ๐ Persistent Sessions | Continue using the app across multiple check-ins without restarting |
| ๐ Interactive Menu | Simple menu-driven interface for easy navigation |
Mental_Health_Simulation/
โ
โโโ Executer.java # ๐ Main entry point โ handles user onboarding & menu loop
โโโ Assistant.java # ๐ค Core assistant โ orchestrates sessions, moods & exercises
โโโ User.java # ๐ค User model โ stores name and mood history (ArrayList)
โโโ MoodTracker.java # ๐ญ Mood input โ prompts user for current emotional state
โโโ QuoteProvider.java # ๐ฌ Quote engine โ serves random motivational quotes
โโโ CalmActivity.java # ๐ง Breathing exercise โ timed guided relaxation routine
classDiagram
class Executer {
+main(String[] args)
}
class Assistant {
-User user
-CalmActivity ca
-QuoteProvider qp
-MoodTracker mt
+startSession(Scanner sc)
+showMoodHistory()
}
class User {
-String name
-ArrayList~String~ moodHistory
+getName() String
+getMoodHistory() ArrayList~String~
+addMoodHistory(String currentMood)
}
class MoodTracker {
+askMood(Scanner sc, User user) String
}
class QuoteProvider {
-String[] quotes
+getRandomQuote() String
}
class CalmActivity {
+breathingExercise()
}
Executer --> Assistant : creates
Executer --> User : creates
Assistant --> User : uses
Assistant --> CalmActivity : uses
Assistant --> QuoteProvider : uses
Assistant --> MoodTracker : uses
- Java JDK 8 or higher installed on your system
- A terminal / command prompt
# 1. Clone the repository
git clone https://github.com/Ritikkumar2525/Mental_Health_Simulation.git
# 2. Navigate to the project directory
cd Mental_Health_Simulation
# 3. Compile all Java files
javac -d . *.java
# 4. Run the application
java Mental_Health_Simulation.Executerflowchart TD
A[๐ Start Application] --> B[Enter Your Name]
B --> C[๐ Check-in Menu]
C --> D{Choose Option}
D -->|1. Start Session| E[๐ญ How are you feeling?]
E --> F[Select Mood]
F --> G[๐ Log Mood to History]
G --> H[๐ฌ Receive Motivational Quote]
H --> I{Want Breathing Exercise?}
I -->|Yes| J[๐ง Guided Breathing<br>3 Rounds ร 8 seconds]
I -->|No| K[Session Complete โ
]
J --> K
K --> C
D -->|2. Show Mood History| L[๐ Display All Logged Moods]
L --> C
D -->|3. Terminate| M[๐ Goodbye Message]
Hii, what is your name?
> Ritik
*** Checkin Menu ***
1. Start Session
2. Show Mood History
3. Terminate Session
> 1
Hii Ritik, how are you feeling today?
"Option: Happy, Sad, Anxious, Angry, Tired, Excited, Okay"
Your mood :
> Happy
Logging the mood history
"You are braver than you believe, stronger than you seem, and smarter than you think. - A.A. Milne"
Would you like to do some Exercise? (yes/no):
> yes
We will start with a simple breathing exercise.
Breath in...
Hold...
Breath out...
(repeats 3 times)
Great job! I hope you feel more relaxed now.
| Aspect | Details |
|---|---|
| Language | Java |
| Paradigm | Object-Oriented Programming (OOP) |
| Design Pattern | Composition over Inheritance |
| Data Structures | ArrayList<String> for mood history, String[] for quotes |
| Concurrency | Thread.sleep() for timed breathing exercises |
| I/O | Scanner for console input, System.out for output |
| Randomization | java.util.Random for quote selection |
- Encapsulation โ Private fields with public getters in
Userclass - Composition โ
AssistantcomposesMoodTracker,QuoteProvider, andCalmActivity - Single Responsibility โ Each class has one focused purpose
- Modular Design โ Clean separation of concerns across 6 classes
"The greatest glory in living lies not in never falling, but in rising every time we fall." โ Nelson Mandela
"The only impossible journey is the one you never begin." โ Tony Robbins
"In the middle of every difficulty lies opportunity." โ Albert Einstein
"What lies behind us and what lies before us are tiny matters compared to what lies within us." โ Ralph Waldo Emerson
"You are braver than you believe, stronger than you seem, and smarter than you think." โ A.A. Milne
- Add mood-based personalized recommendations
- Implement journaling feature for daily reflections
- Add data persistence using file I/O or database
- Include more calming activities (progressive muscle relaxation, visualization)
- Build a GUI version using JavaFX or Swing
- Add mood analytics with trend charts
- Integrate more comprehensive quote categories
Contributions are welcome! Feel free to:
- Fork the repository
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is open source and available under the MIT License.
Ritik Kumar
- GitHub: @Ritikkumar2525