Advertisement
Guest User

Jimmy you lazy motherfucker, do your work

a guest
Dec 18th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.56 KB | None | 0 0
  1. //
  2. public int diff21(int n) {
  3.   if (n > 21) {
  4.     return (n - 21)*2;
  5.   } else {
  6.     return 21 - n;
  7.   }
  8. }
  9. //
  10. public boolean parrotTrouble(boolean talking, int hour) {
  11.   if (talking && (hour > 20 || hour < 7)) {
  12.     return true;
  13.   } else {
  14.     return false;
  15.   }
  16. }
  17. //
  18. public boolean makes10(int a, int b) {
  19.   if (a == 10 || b == 10 || a + b == 10) {
  20.     return true;
  21.   } else {
  22.     return false;
  23.   }
  24. }
  25. //
  26. public boolean nearHundred(int n) {
  27.   if (Math.abs(n - 100) <= 10 || Math.abs(n - 200) <= 10) {
  28.     return true;
  29.   } else {
  30.     return false;
  31.   }
  32. }
  33. //
  34. public boolean posNeg(int a, int b, boolean negative) {
  35.   if (negative) {
  36.     return (a < 0 && b < 0);
  37.   }
  38.   else {
  39.     return ((a < 0 && b > 0) || (a > 0 && b < 0));
  40.   }
  41. }
  42. //
  43. public String notString(String str) {
  44.   if (str.startsWith("not")) {
  45.     return str;
  46.   } else {
  47.     return "not " + str;
  48.   }
  49. }
  50. //
  51. public String missingChar(String str, int n) {
  52.   String front = str.substring(0, n);
  53.   String back = str.substring(n+1, str.length());
  54.  
  55.   return front + back;
  56. }
  57. //
  58. public String frontBack(String str) {
  59.    if (str.length() < 2) {
  60.      return str;
  61.    } else {
  62.    char fletter = str.charAt(0);
  63.    char lletter = str.charAt(str.length() - 1);
  64.    String middle = str.substring(1, str.length() - 1);
  65.    return lletter + middle + fletter;
  66.    }
  67. }
  68. //
  69. public String front3(String str) {
  70.   if (str.length() < 3) {
  71.     return str + str + str;
  72.   } else {
  73.   String start = str.substring(0, 3);
  74.   return start + start + start;
  75.   }
  76. }
  77. //
  78. public String backAround(String str) {
  79.   char c1 = str.charAt(str.length() - 1);
  80.   return c1 + str + c1;
  81. }
  82. //
  83. public boolean or35(int n) {
  84.   if(n%3 == 0 || n%5 == 0) {
  85.     return true;
  86.   } else {
  87.     return false;
  88.   }
  89. }
  90. //
  91. public String front22(String str) {
  92.   if(str.length() < 3) {
  93.     return str + str + str;
  94.   } else {
  95.     String s1 = str.substring(0,2);
  96.     return s1 + str + s1;
  97.   }
  98. }
  99. //
  100. public boolean startHi(String str) {
  101.   if(str.startsWith("hi")) {
  102.     return true;
  103.   } else {
  104.     return false;
  105.   }
  106. }
  107. //
  108. public boolean icyHot(int temp1, int temp2) {
  109.   if ((temp1 > 100 && temp2 < 0) || (temp1 < 0  && temp2 > 100)) {
  110.             return true;
  111.         } else {
  112.             return false;
  113.         }
  114. }
  115. //
  116. public boolean in1020(int a, int b) {
  117.   if ((a <= 20 && a >= 10) || (b <= 20 && b >= 10)) {
  118.     return true;
  119.   } else {
  120.     return false;
  121.   }
  122. }
  123. //
  124. public boolean hasTeen(int a, int b, int c) {
  125.   if ((a <= 19 && a >= 13) || (b <= 19 && b >= 13) || (c <= 19 && c >= 13)) {
  126.     return true;
  127.   } else {
  128.     return false;
  129.   }
  130. }
  131. //
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement