Advertisement
Guest User

TalkToMeBobi

a guest
Feb 19th, 2020
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.90 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class TalkToMeBoby
  4. {
  5.   public static void main(String[] args)
  6.   {
  7.     Scanner sc = new Scanner(System.in);
  8.  
  9.     String userInput;
  10.     int input = 0;
  11.     int questionCount = 0;
  12.     System.out.println("This is Bobi. He is a teenager and he is very \"talkative\". " +
  13.         "\nIf you get tired of talking to him just say \"bye\" and he will shut up." +
  14.         "\nSay something to Bobi and lets see what happens...\n");
  15.  
  16.     do {
  17.       System.out.print("You: ");
  18.       userInput = sc.nextLine();
  19.       if (userInput.contains("Beer") || userInput.contains("beer") && userInput.contains("?")) {
  20.         System.out.println("Bobi: Yes I would love a beer right now, got any on you?");
  21.         questionCount++;
  22.       }
  23.       else if (userInput.contains("?")) {
  24.         questionCount++;
  25.         if (questionCount >= 3) {
  26.           System.out.println("Bobi: Can you stop asking me all these questions?!?");
  27.         }
  28.         else {
  29.           System.out.println("Bobi: Sure.\n");
  30.         }
  31.       }
  32.       else if (userInput.contains("Hi") || userInput.contains("Hello")) {
  33.         System.out.println("Bobi: What do you want?\n");
  34.         questionCount = 0;
  35.       }
  36.       else if (userInput.equals("") || userInput.equals(" ")) {
  37.         System.out.println("Bobi: Whatever...\n");
  38.         questionCount = 0;
  39.       }
  40.       else if (userInput.toUpperCase().equals(userInput)) {
  41.         System.out.println("Bobi: Chill, bro!\n");
  42.         questionCount = 0;
  43.       }
  44.       else if (userInput.equalsIgnoreCase("bye")) {
  45.         System.out.println("Bobi: Just leave me alone dude...");
  46.         return;
  47.       }
  48.       else if (userInput.equalsIgnoreCase("Bobi")) {
  49.         System.out.println("Yep, that's me...\n");
  50.         questionCount = 0;
  51.       }
  52.       else {
  53.         System.out.println("Bobi: Mhm...\n");
  54.         questionCount = 0;
  55.       }
  56.     }
  57.     while (true);
  58.   }
  59. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement