Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class TalkToMeBoby
- {
- public static void main(String[] args)
- {
- Scanner sc = new Scanner(System.in);
- String userInput;
- int input = 0;
- int questionCount = 0;
- System.out.println("This is Bobi. He is a teenager and he is very \"talkative\". " +
- "\nIf you get tired of talking to him just say \"bye\" and he will shut up." +
- "\nSay something to Bobi and lets see what happens...\n");
- do {
- System.out.print("You: ");
- userInput = sc.nextLine();
- if (userInput.contains("Beer") || userInput.contains("beer") && userInput.contains("?")) {
- System.out.println("Bobi: Yes I would love a beer right now, got any on you?");
- questionCount++;
- }
- else if (userInput.contains("?")) {
- questionCount++;
- if (questionCount >= 3) {
- System.out.println("Bobi: Can you stop asking me all these questions?!?");
- }
- else {
- System.out.println("Bobi: Sure.\n");
- }
- }
- else if (userInput.contains("Hi") || userInput.contains("Hello")) {
- System.out.println("Bobi: What do you want?\n");
- questionCount = 0;
- }
- else if (userInput.equals("") || userInput.equals(" ")) {
- System.out.println("Bobi: Whatever...\n");
- questionCount = 0;
- }
- else if (userInput.toUpperCase().equals(userInput)) {
- System.out.println("Bobi: Chill, bro!\n");
- questionCount = 0;
- }
- else if (userInput.equalsIgnoreCase("bye")) {
- System.out.println("Bobi: Just leave me alone dude...");
- return;
- }
- else if (userInput.equalsIgnoreCase("Bobi")) {
- System.out.println("Yep, that's me...\n");
- questionCount = 0;
- }
- else {
- System.out.println("Bobi: Mhm...\n");
- questionCount = 0;
- }
- }
- while (true);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement