Skip to content

Repository files navigation

๐Ÿง  Mental Health Simulation

A Console-Based Mental Wellness Companion Built with Java

Java License GitHub stars

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.


๐Ÿ“– About

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.


โœจ Features

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

๐Ÿ—๏ธ Project Architecture

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

Class Relationships

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
Loading

๐Ÿš€ Getting Started

Prerequisites

  • Java JDK 8 or higher installed on your system
  • A terminal / command prompt

Installation & Run

# 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.Executer

๐ŸŽฎ How It Works

Application Flow

flowchart 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]
Loading

Sample Session

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.

๐Ÿ”ง Technical Details

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

Key OOP Concepts Demonstrated

  • Encapsulation โ€” Private fields with public getters in User class
  • Composition โ€” Assistant composes MoodTracker, QuoteProvider, and CalmActivity
  • Single Responsibility โ€” Each class has one focused purpose
  • Modular Design โ€” Clean separation of concerns across 6 classes

๐ŸŒŸ Motivational Quotes Included

"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


๐Ÿ› ๏ธ Future Enhancements

  • 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

๐Ÿค Contributing

Contributions are welcome! Feel free to:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

๐Ÿ“„ License

This project is open source and available under the MIT License.


๐Ÿ‘จโ€๐Ÿ’ป Author

Ritik Kumar


๐Ÿ’š "Your mental health matters. Take a moment to breathe."

โญ If you found this helpful, please give it a star! โญ

About

๐Ÿง  A Java-based console mental health companion โ€” track moods, practice guided breathing exercises & receive motivational quotes. Built with OOP principles.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages