Advertisement
mendozaa_

Final Project

Jun 10th, 2019
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.27 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class Quiz
  4. {
  5.  
  6. public static void main(String[] args)
  7. {
  8. int score = 0;
  9. Scanner scan = new Scanner(System.in);
  10.  
  11.  
  12. System.out.println("Welcome to the Personality Quiz: Are you more Type A or Type B? \n First, what is your name?");
  13. String name = scan.nextLine();
  14.  
  15. System.out.println("Welcome " + name + "!");
  16. System.out.println("Lets Begin!");
  17.  
  18. System.out.println();
  19. System.out.println();
  20. System.out.println();
  21.  
  22.  
  23. System.out.println( "Question 1:\n"
  24. + "You have a test on Friday. It's monday, when do you start studying?\n"
  25. + "1. Tonight\n"
  26. + "2. Thursday night");
  27.  
  28.  
  29. System.out.println("Type the number of your answer here:");
  30. int a1 = scan.nextInt();
  31.  
  32. if(a1 == 1)
  33. {
  34. score = score - 5;
  35. }
  36. else if(a1 == 2)
  37. {
  38. score = score + 5;
  39. }
  40. else
  41. {
  42. System.out.println("Invalid Answer. START AGAIN.");
  43. System.exit(0);
  44. }
  45.  
  46. System.out.println();
  47. System.out.println();
  48. System.out.println();
  49.  
  50.  
  51. System.out.println("Question 2:\n"
  52. + "You're at a house party where you know no one, your only friend leaves early.\n What do you do? \n"
  53. + "1. Try to make new friends\n "
  54. + "2. Leave immediately");
  55.  
  56. System.out.println("Type the number of your answer here:");
  57. int a2 = scan.nextInt();
  58.  
  59. if(a2 == 1)
  60. {
  61. score = score + 5;
  62. }
  63. else if (a2 == 2)
  64. {
  65. score = score - 5;
  66. }
  67. else
  68. {
  69. System.out.println("Invalid Answer. START AGAIN.");
  70. System.exit(0);
  71. }
  72.  
  73. System.out.println();
  74. System.out.println();
  75. System.out.println();
  76.  
  77.  
  78.  
  79. System.out.println("Question 3: \n"
  80. + "You're babysitting two little boys, they ask you to play checkers. How do you play? \n"
  81. + "1. Play a fair game \n"
  82. + "2. Let the kids win");
  83. System.out.println("Type the number of your answer here:");
  84. int a3= scan.nextInt();
  85.  
  86. if (a3 == 1)
  87. {
  88. score= score -5;
  89. }
  90. else if (a3 == 2)
  91. {
  92. score= score + 5;
  93. }
  94. else
  95. {
  96. System.out.println("Invalid Answer. START AGAIN.");
  97. }
  98.  
  99.  
  100. System.out.println();
  101. System.out.println();
  102. System.out.println();
  103.  
  104.  
  105. System.out.println("Question 4: \n"
  106. + "A young girl is kicking your seat from behind on a long airplane flight. What do you do about it?\n"
  107. + "1. Turn around and immediately tell them to stop \n"
  108. + "2. Try to ignore it");
  109. System.out.println("Type the number of your answer here:");
  110. int a4 = scan.nextInt();
  111.  
  112. if (a4 == 1)
  113. {
  114. score = score - 5;
  115. }
  116. else if (a4 == 2)
  117. {
  118. score = score + 5;
  119. }
  120. else
  121. {
  122. System.out.println("Invalid Answer. START AGAIN");
  123. }
  124.  
  125. System.out.println();
  126. System.out.println();
  127. System.out.println();
  128.  
  129. System.out.println("Question 5: \n"
  130. + "You bus leaves at 7:15 am. What time do you wake up? \n"
  131. + "1. 6:00 am /n"
  132. + "2. 7:00 am");
  133. System.out.println("Type the number of your answer here:");
  134. int a5 = scan.nextInt();
  135.  
  136. if (a5 == 1)
  137. {
  138. score = score - 5;
  139. }
  140. else if (a5 == 2)
  141. {
  142. score = score + 5;
  143. }
  144. else
  145. {
  146. System.out.println("Invalid Answer. START AGAIN.");
  147. }
  148. System.out.println();
  149. System.out.println();
  150. System.out.println();
  151. System.out.println("Question 6: /n"
  152. + "You just failed a math test that you studied a lot for, and you feel horrible. What do you do?\n"
  153. + "1. Talk to your teacher or parents \n"
  154. + "2. Keep it to yourself, and study for the next test");
  155. System.out.println("Type the number of your answer here:");
  156. int a6= scan.nextInt();
  157.  
  158. if (a6 ==1 )
  159. {
  160. score = score + 5;
  161. }
  162. else if (a6 == 2)
  163. {
  164. score = score - 5;
  165. }
  166. else
  167. {
  168. System.out.println("Invalid Answer. START AGAIN.");
  169. }
  170.  
  171. if (score>0)
  172. {
  173. System.out.println("You are Type B Personality. You take life as it goes and live freely /n"
  174. + "Showing up on time is not a priority to you. ");
  175. }
  176. if (score<0)
  177. {
  178. System.out.println("You are Type A Personality. You tend to live life closer to a schedule and \n"+
  179. "you also tend to be less outgoing and more of a wallflower.");
  180. }
  181. if (score==0)
  182. {
  183. System.out.println("You are neither type A nor type B");
  184. }
  185.  
  186.  
  187.  
  188. }
  189.  
  190. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement