Skip to content

OptimisticPanda2/MoofStory

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 

Repository files navigation

import java.util.Scanner; impory java.util.Random;

public class MoodApp { public static void main(String[] args) { Scanner scanner = new Scanner(System.in);

    System.out.println("πŸ‘‹ Welcome to MoodStory Generator!");
    System.out.print("Enter your name: ");
    String name = scanner.nextLine();

    System.out.print("How are you feeling today? (happy/sad/angry): ");
    String mood = scanner.nextLine().toLowerCase();

    MoodStory moodStory;

    switch (mood) {
        case "happy":
            moodStory = new HappyMood();
            break;
        case "sad":
            moodStory = new SadMood();
            break;
        case "angry":
            moodStory = new AngryMood();
            break;
        default:
            System.out.println("πŸ˜• Sorry, I don't recognize that mood.");
            return;
    }

    moodStory.generateStory(name);
    scanner.close();
}

} public interface MoodStory { void generateStory(String userName); }

public class HappyMood implements MoodStory { public void generateStory(String userName) { String[] activities = {"danced in the rain", "ate ice cream", "played with puppies", "watched a sunset"}; String[] places = {"at the beach", "in a sunny park", "under a cherry blossom tree"}; String[] feelings = {"joyful", "excited", "blessed"};

    Random r = new Random();
    String activity = activities[r.nextInt(activities.length)];
    String place = places[r.nextInt(places.length)];
    String feeling = feelings[r.nextInt(feelings.length)];

    System.out.println("🌞 Today " + userName + " felt " + feeling + ", " + activity + " " + place + ". It was a wonderful day! 😊");
}

}

public class SadMood implements MoodStory { public void generateStory(String userName) { String[] thoughts = {"missed an old friend", "felt lost", "watched the rain alone"}; String[] places = {"by the window", "in a quiet room", "walking alone on the street"}; String[] feelings = {"lonely", "blue", "a little broken"};

    Random r = new Random();
    String thought = thoughts[r.nextInt(thoughts.length)];
    String place = places[r.nextInt(places.length)];
    String feeling = feelings[r.nextInt(feelings.length)];

    System.out.println("🌧️ " + userName + " was feeling " + feeling + ". They " + thought + " " + place + ". A soft sadness lingered in the air. πŸ˜”");
}

}

public class AngryMood implements MoodStory { public void generateStory(String userName) { String[] reasons = {"someone cut them in traffic", "lost their favorite pen", "phone battery died in an important call"}; String[] reactions = {"took a deep breath", "punched a pillow", "went for a walk to calm down"}; String[] outcomes = {"felt slightly better", "realized it's okay", "let it go eventually"};

    Random r = new Random();
    String reason = reasons[r.nextInt(reasons.length)];
    String reaction = reactions[r.nextInt(reactions.length)];
    String outcome = outcomes[r.nextInt(outcomes.length)];

    System.out.println("πŸ”₯ " + userName + " got angry because " + reason + ". They " + reaction + " and " + outcome + ". Emotions settled slowly. 😀");
}

}

About

Java Project which genrates a little story based on the mood of user which the console application get inserted by scanner utility from the user.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors