Advertisement
kocev

Bobby

Feb 19th, 2020
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.19 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Bobby {
  4.     public static void main(String[] args) {
  5.         Scanner scanner = new Scanner(System.in);
  6.         while (scanner.hasNextLine()) {
  7.             String sentence = scanner.nextLine();
  8.             boolean isScold = false;
  9.             char[] sentenceArr = sentence.toCharArray();
  10.             for (int i = 0; i < sentenceArr.length; i++) {
  11.                 if (!Character.isLetter(sentenceArr[i])) {
  12.                     continue;
  13.                 }
  14.                 if (Character.isUpperCase(sentenceArr[i])) {
  15.                     isScold = true;
  16.                 }
  17.             }
  18.             if (sentence.endsWith("?") && !isScold) {
  19.                 System.out.println("Добре!");
  20.             } else if (sentence.endsWith("?") && isScold) {
  21.                 System.out.println("Спокоооо, знам к'во правя!");
  22.             } else if (sentence.endsWith("!") && isScold) {
  23.                 System.out.println("Споко бе мен!");
  24.             } else if ("".equals(sentence)) {
  25.                 System.out.println("Хубаво деее");
  26.             } else
  27.                 System.out.println("Ахъ");
  28.  
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement