Advertisement
Guest User

Untitled

a guest
Dec 16th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.90 KB | None | 0 0
  1. import java.util.Scanner;
  2. public class sortingHat
  3. {
  4.  
  5.  
  6. public static void printingStuff()
  7.  
  8. {
  9. Scanner scan = new Scanner(System.in);
  10. {
  11. System.out.println ("What's your favourite pet?");
  12. System.out.println ("A. Guinea Pig");
  13. System.out.println ("B. A dog");
  14. System.out.println ("C. A cat");
  15. System.out.println ("D. other");
  16. }
  17. String favouritePetLetter = scan.nextLine();
  18. if (favouritePetLetter.equals("A"))
  19. {
  20. String favouritePet = "guinea pig";
  21. }
  22. else if (favouritePetLetter.equals("B"))
  23. {
  24. String favouritePet = "dog";
  25. }
  26. else if (favouritePetLetter.equals("C"))
  27. {
  28. String favouritePet = "cat";
  29. }
  30. else
  31. {
  32. String favouritePet = "other";
  33. }
  34. System.out.println ("What's your favourite car out of:");
  35. System.out.println ("A. Chevrolet Camaro");
  36. System.out.println ("B. Chevrolet Suburban");
  37. System.out.println ("C. Renault Twingo");
  38. System.out.println ("D. Toyota Corolla");
  39.  
  40. String favouriteCarLetter = scan.nextLine();
  41. if (favouriteCarLetter.equals("A"))
  42. {
  43. String favouriteCar = "Chevy Camaro";
  44. }
  45. else if (favouriteCarLetter.equals("B"))
  46. {
  47. String favouriteCar = "Chevy Suburban";
  48. }
  49. else if (favouriteCarLetter.equals("C"))
  50. {
  51. String favouriteCar = "Renault Twingo";
  52. }
  53. else
  54. {
  55. String favouriteCar = "Toyota Corolla";
  56. }
  57.  
  58. System.out.println ("Have you ever crashed a car? y/n");
  59.  
  60. String crashedCarValue = scan.nextLine();
  61. if (crashedCarValue.equals("y"))
  62. {
  63. boolean everCrashedCar = true;
  64. }
  65. else
  66. {
  67. boolean everCrashedCar = false;
  68. }
  69. System.out.println ("How many times have you broken a bone?");
  70.  
  71. int amountOfTimesBrokenBone = scan.nextLine;
  72.  
  73. String house = sortingHat();
  74.  
  75.  
  76. }
  77. public static String sortingHat (String favouritePet,String favouriteCar,boolean everCrashedCar,int amountOfTimesBrokenBone);
  78. {
  79. int Ravenclaw = 0;
  80. int Gryffindor = 0;
  81. int Slytherin = 0;
  82. int Hufflepuff = 0;
  83. if (favouritePet == "guinea pig")
  84. {
  85. int Hufflepuff = Hufflepuff + 1;
  86. }
  87. else if (favouritePet == "dog")
  88. {
  89. Gryffindor += 1;
  90. }
  91. else if (favouritePet == "cat")
  92. {
  93. Ravenclaw += 1;
  94. }
  95. else
  96. {
  97. Slytherin += 1;
  98. }
  99. //Only evil people like pets besides the three listed
  100. if (favouriteCar == "Chevy Camaro")
  101. {
  102. Gryffindor += 1;
  103. //the camaro is dumb, underpowered, impractical, and will only impress the most vapid of people
  104. //just like gryffindors
  105. }
  106. else if (favouriteCar == "Chevy Suburban")
  107. {
  108. Slytherin += 1;
  109. //every evil mercenary's car in every action movie
  110. }
  111. else if (favouriteCar == "Renault Twingo")
  112. {
  113. Hufflepuff += 1;
  114. //A little weird, but hard to hate and most likely in on the joke
  115. }
  116. else if (favouriteCar == "Toyota Corolla")
  117. {
  118. Ravenclaw += 1;
  119. //Either its the Trueno 86, which is the thinking man's car for drifting, or its the boring car
  120. //for "that kid" in history class who always argues with the teacher
  121. }
  122. //mocking people for their taste in cars is fun
  123. if (everCrashedCar = true)
  124. {
  125. Gryffindor += 1;
  126. Hufflepuff += 1;
  127. }
  128. else
  129. {
  130. Slytherin += 1;
  131. Ravenclaw += 1;
  132. }
  133. //gryffindors crashed their car on a dare, hufflepuffs crashed it while spaced out
  134. if (amountOfTimesBrokenBone < 5)
  135. {
  136. Gryffindor += 1;
  137. //
  138. }
  139. else if (amountOfTimesBrokenBone <= 5 && amountOfTimesBrokenBone == 1)
  140. {
  141. Hufflepuff += 1;
  142. }
  143. else if (amountOfTimesBrokenBone == 1)
  144. {
  145. Slytherin += 1;
  146. }
  147. else
  148. {
  149. Ravenclaw += 1;
  150. }
  151. if (Gryffindor > Slytherin && Gryffindor > Ravenclaw && Gryffindor > Hufflepuff)
  152. {
  153. return "Gryffindor";
  154. }
  155. else if (Slytherin > Gryffindor && Slytherin > Ravenclaw && Slytherin > Hufflepuff)
  156. {
  157. return "Slytherin";
  158. }
  159. else if (Ravenclaw > Gryffindor && Ravenclaw > Slytherin && Ravenclaw > Hufflepuff)
  160. {
  161. return "Ravenclaw";
  162. }
  163. else if (Hufflepuff > Gryffindor && Hufflepuff > Slytherin && Hufflepuff > Ravenclaw)
  164. {
  165. return "Hufflepuff";
  166. }
  167. String house = sortingHat(favouritePet, );
  168. }
  169.  
  170. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement