remote87

Bobby Talks

Dec 3rd, 2020
560
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import java.io.*;
  2. import java.util.Scanner;
  3. // винаги използвайте клас Main, инак ще получите грешка при компилиране!
  4. public class Main {
  5.   public static void main(String[] args) {
  6.         Scanner scan = new Scanner(System.in);
  7.         String talk = scan.nextLine();
  8.  
  9.  
  10.         while(!talk.equals(".")){
  11.             bobby(talk);
  12.             talk = scan.nextLine();
  13.         }
  14.     }
  15.  
  16.     public static void bobby(String talk){
  17.         if(talk.isEmpty()) System.out.println("Хубаво деее");
  18.         else{
  19.             boolean endsWithQuestMark = talk.charAt(talk.length() - 1) == '?';
  20.             boolean isAllUpperCase = talk.equals(talk.toUpperCase());
  21.  
  22.             if(endsWithQuestMark && isAllUpperCase) System.out.println("Спокоооо, знам к'во правя!");
  23.             else if(endsWithQuestMark) System.out.println("Добре.");
  24.             else if(isAllUpperCase) System.out.println("Споко бе, ман!");
  25.  
  26.             else System.out.println("Ахъ.");
  27.         }
  28.     }
  29. }
RAW Paste Data