willieshi232

Untitled

Aug 28th, 2017
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.07 KB | None | 0 0
  1. 1.
  2. import java.util.*;
  3. public class NumberJeopardy
  4. {
  5. public static void main(String [] args)
  6. {
  7. System.out.println("Gimme your Equations");
  8. Scanner console = new Scanner(System.in);
  9. String input = console.next();
  10. System.out.println(input);
  11. }
  12. }
  13. 2.
  14. import java.util.*;
  15. public class Bronumbers
  16. {
  17. public static void main(String[] args)
  18. {
  19. Scanner console = new Scanner(System.in);
  20. System.out.println("Onii chan gimme the amount of numbers you wanna input");
  21. int number = console.nextInt();
  22. for(int i = 0; i < number)
  23. {
  24. String input = console.next();
  25. if(input.length == 5)
  26. {
  27. System.out.println("3");
  28. }
  29. else
  30. {
  31. if(input.charAt(0) == o)
  32. {
  33. if(input.charAt(1) == w)
  34. {
  35. if(input.charAt(2) == e)
  36. {
  37. System.out.println("1")
  38. }
  39. else
  40. {
  41. System.out.println("2")
  42. }
  43. }
  44.  
  45. else if(input.chartAt(1) == n)
  46. {
  47. System.out.println("1")
  48. }
  49. }
  50. else
  51. {
  52. if(chartAt(1) == n)
  53. {
  54. if(charAt(2) == e)
  55. {
  56. System.out.println("1");
  57. }
  58. else
  59. {
  60. System.out.prntln("2");
  61. }
  62. }
  63.  
  64. }
  65. }
  66. }
  67. }
  68. 3.
  69. /**
  70. * Created by WillieShi on 8/26/2017.
  71. */
  72. import java.util.*;
  73. public class Depreciation
  74. {
  75. public static double[][] deprecbymonth;
  76.  
  77. public static void main(String[] args)
  78. {
  79. int months;
  80. double down;
  81. double loanleft;
  82. double carvalue;
  83. int numrec;
  84. int monthcount = 0;
  85.  
  86. Scanner console = new Scanner(System.in);
  87. System.out.print("Gimme the info about your debt");
  88. String data = console.next();
  89. Scanner stringbreak = new Scanner(data);
  90. months = Integer.parseInt(stringbreak.next());
  91. down = Double.parseDouble(stringbreak.next());
  92. loanleft = Double.parseDouble(stringbreak.next());
  93. numrec = Integer.parseInt(stringbreak.next());
  94. deprecbymonth = new double[months+1][2];
  95. carvalue = loanleft+500;
  96.  
  97. populate(deprecbymonth, numrec, months);
  98.  
  99. while(carvalue < loanleft)
  100. {
  101. carvalue = carvalue- carvalue*deprecbymonth[2][monthcount];
  102. loanleft = loanleft - 500;
  103. System.out.println(carvalue+ " " + loanleft);
  104. monthcount++;
  105. }
  106.  
  107.  
  108. }
  109. public static void populate(double[][] deprecbymonth, int numrec, int months)
  110. {
  111. int month;
  112. double depval;
  113. int prevmonth = 0;
  114. double predepval = 0.0;
  115. String temp;
  116. Scanner console = new Scanner(System.in);
  117. for(int i = 0; i< numrec; i++)
  118. {
  119. System.out.println("Gimme the" + i + "th datapoint");
  120. temp = console.next();
  121. Scanner stringbreak = new Scanner(temp);
  122. month = Integer.parseInt(stringbreak.next());
  123. depval = Double.parseDouble(stringbreak.next());
  124. if(i != 0)
  125. {
  126. if(i == numrec-1)
  127. {
  128. for(i = prevmonth; i <= month; i++)
  129. {
  130. deprecbymonth[2][i] = depval;
  131. }
  132. }
  133.  
  134. else
  135. {
  136. for(i = prevmonth; i <= month - prevmonth; i++)
  137. {
  138. deprecbymonth[2][i] = predepval;
  139. }
  140. }
  141.  
  142. }
  143. prevmonth = month;
  144. predepval = depval;
  145.  
  146.  
  147. }
  148. }
  149. }
  150. 4.
  151. import java.util.*;
  152.  
  153. public class mrBean
  154. {
  155.  
  156. public static void main(String[] args)
  157. {
  158. int amount;
  159. int temp;
  160. int count = 0;
  161.  
  162. String templine;
  163. System.out.println("Give me the amount of inputs");
  164. Scanner console = new Scanner(System.in);
  165. amount = console.nextInt();
  166. console.nextLine();
  167. for(int i = 0; i < amount; i++)
  168. {
  169. System.out.println("Gimme the input" + (i+1));
  170. templine = console.nextLine();
  171. Scanner stringbreak = new Scanner(templine);
  172. for(int y = 0; y < 3; y++)
  173. {
  174. temp = Integer.parseInt(stringbreak.next());
  175. if(temp > 20 )
  176. {
  177. System.out.println(temp);
  178. System.out.println("Case" + (i+1) + "bad");
  179. break;
  180. }
  181. count++;
  182. }
  183. if(count == 3)
  184. {
  185. System.out.println("Case" + i+1 + "good");
  186. count = 0;
  187. }
  188.  
  189.  
  190. }
  191.  
  192.  
  193. }
  194. }
  195. 5.
  196. import java.util.*;
  197.  
  198. public class hajj
  199. {
  200. public static void main(String[] args)
  201. {
  202. System.out.println("Input");
  203. Scanner dingus = new Scanner(System.in);
  204. String output = "";
  205. String dingle;
  206. int i = 1;
  207. do
  208. {
  209. dingle = dingus.nextLine();
  210. if(dingle.equals("Hajj"))
  211. {
  212. output += "Case " + i + ": Hajj-e-Akbar /n";
  213. }
  214. else if(dingle.equals("Umrah"))
  215. {
  216. output += "Case " + i + ": Hajj-e-Asghar /n";
  217. }
  218. else
  219. {
  220. break;
  221. }
  222. i++;
  223. }
  224. while(dingle != "*");
  225. System.out.println(output);
  226. }
  227. }
  228. 6.
  229. import java.util.*;
  230. public class Donate
  231. {
  232. public static void main(String [] args)
  233. {
  234. int inputs;
  235. String temp;
  236. int money = 0;
  237. Scanner console = new Scanner(System.in);
  238. inputs = Integer.parseInt(console.nextLine());
  239. for(int i = 0; i < inputs; i++)
  240. {
  241. temp = console.nextLine();
  242. Scanner stringbreak = new Scanner(temp);
  243. if(stringbreak.next() == "donate")
  244. {
  245. money = money + Integer.parseInt(stringbreak.next());
  246. }
  247. else
  248. {
  249. System.out.println(money);
  250. }
  251. }
  252. }
  253. }
  254. 7.
  255. import java.util.*;
  256.  
  257. public class Swallow
  258. {
  259. public static void main(String[]args)
  260. {
  261. int repeattimes;
  262. int columns;
  263. String tempinput;
  264. boolean test = true;
  265. int gaps = 0;
  266. int x;
  267. int y;
  268.  
  269. Scanner console = new Scanner(System.in);
  270. System.out.println("Gimme the repeats");
  271. repeattimes = console.nextInt();
  272. console.nextLine();
  273. System.out.println("Gimme the columns");
  274. columns = console.nextInt();
  275. console.nextLine();
  276.  
  277. for(int i = 0; i < repeattimes; i++)
  278. {
  279. for(int j = 0; j < columns; j++)
  280. {
  281. System.out.println("Gimme the column");
  282. tempinput = console.nextLine();
  283. Scanner stringbreak = new Scanner(tempinput);
  284. x = Integer.parseInt(stringbreak.next());
  285. y = Integer.parseInt(stringbreak.next());
  286. if(j == 0)
  287. {
  288. gaps = x - y;
  289. }
  290. else
  291. {
  292. if(x - y != gaps)
  293. {
  294. test = false;
  295. }
  296. }
  297. }
  298. if(test = true)
  299. {
  300. System.out.println("yes");
  301. }
  302. }
  303. }
  304. }
Advertisement
Add Comment
Please, Sign In to add comment