Advertisement
Guest User

Untitled

a guest
Dec 6th, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.89 KB | None | 0 0
  1. import java.util.*;
  2.  
  3. public class HarringtonRunTeam
  4. {
  5. public static void main(String[] args)
  6. {
  7. int salarytotal = 0;
  8. int WR = 0;
  9. int RB = 0;
  10. int TE = 0;
  11. int QB = 0;
  12. int players = 0;
  13. int salary = 0;
  14. boolean hasQB = false;
  15. boolean hasTE = false;
  16.  
  17. System.out.println("Welcome to Fantasy Football!");
  18. System.out.println("\nYour offensive line will require the following:");
  19. System.out.println("\t1 Quarterback (QB)");
  20. System.out.println("\t1 Tight End (TE)");
  21. System.out.println("\t2 Running Backs (RB)");
  22. System.out.println("\t2 Wide Receivers (WR)");
  23. System.out.println("\nYour salary cap is $30 million");
  24. System.out.println("\nYou need a minimum of 6 players; max is 10 players.");
  25.  
  26. while ( players <= 10 && salary <= 30000000 )
  27. {
  28. Scanner keyboard = new Scanner(System.in);
  29. System.out.println("\nEnter your team name: ");
  30. String teamName = keyboard.nextLine();
  31.  
  32. System.out.println("Would you like to enter player data?: (y/n)");
  33. char response = keyboard.next().charAt(0);
  34.  
  35. if (response == 'y')
  36. {
  37. System.out.println("Enter player's name: ");
  38. String playerName = keyboard.nextLine();
  39. System.out.println(playerName + "'s position: (qb, te, rb, wr)");
  40. char position = keyboard.next().charAt(0);
  41. if (position == 'q')
  42. {
  43. if ( QB == 0 )
  44. {
  45. hasQB = true;
  46. players++;
  47. QB++;
  48. }
  49. else if ( QB == 1 )
  50. {
  51. System.out.println("You have reached the limit of Quarterbacks on your team! Restarting...");
  52. return;
  53. }
  54. }
  55. if (position == 't')
  56. {
  57. if ( TE == 0 )
  58. {
  59. hasTE = true;
  60. players++;
  61. TE++;
  62. }
  63. else if ( TE == 1 )
  64. {
  65. System.out.println("You have reached the limit of Tight Ends on your team! Restarting...");
  66. return;
  67. }
  68. }
  69. if (position == 'r')
  70. {
  71. if ( RB <= 3)
  72. {
  73. players++;
  74. RB++;
  75. }
  76. else if ( RB == 4 )
  77. {
  78. System.out.println("You have reached the limit of Running Backs on your team! Restarting...");
  79. return;
  80. }
  81. }
  82. if (position == 'w')
  83. {
  84. if ( WR <= 3 )
  85. {
  86. players++;
  87. WR++;
  88. }
  89. else if ( WR == 5 )
  90. {
  91. System.out.println("You have reached the limit of Wide Receivers on your team! Returning...");
  92. return;
  93. }
  94. }
  95. System.out.println("Enter " + playerName + "'s salary: ");
  96. int salary1 = keyboard.nextInt();
  97. salarytotal += salary1;
  98. System.out.println("\nWould you like to enter another player? (y/n)");
  99. char response1 = keyboard.next().charAt(0);
  100. {
  101. if ( response1 == 'n' )
  102. {
  103. System.out.println(teamName);
  104. System.out.println("\tSalary: $" + salarytotal);
  105. System.out.println("\t" + players + " players");
  106. if (hasQB == false)
  107. {
  108. System.out.println("\tNo Quarterback");
  109. }
  110. if (hasQB == true)
  111. {
  112. System.out.println("\tQuarterback");
  113. }
  114. if (hasTE == false)
  115. {
  116. System.out.println("\tNo Tight End");
  117. }
  118. if (hasTE == true)
  119. {
  120. System.out.println("\tTight End");
  121. }
  122. System.out.println("\t" + RB + " Running Backs");
  123. System.out.println("\t" + WR + " Wide Receivers");
  124. if ( players <= 5 || players >= 11 || salarytotal <= 30000000 )
  125. {
  126. System.out.println("\n" + teamName + " does not meet team requirements.");
  127. return;
  128. }
  129. else if ( players >= 6 || players <= 10 || salarytotal > 30000000 )
  130. {
  131. System.out.println("\n" + teamName + " meets team requirements.");
  132. return;
  133. }
  134. salary = 0;
  135. WR = 0;
  136. TE = 0;
  137. QB = 0;
  138. RB = 0;
  139. }
  140. }
  141. if (response == 'n')
  142. {
  143. System.out.println("test");
  144. return;
  145. }
  146. }
  147. }
  148. }
  149. }import java.util.*;
  150.  
  151. public class HarringtonRunTeam
  152. {
  153. public static void main(String[] args)
  154. {
  155. int salarytotal = 0;
  156. int WR = 0;
  157. int RB = 0;
  158. int TE = 0;
  159. int QB = 0;
  160. int players = 0;
  161. int salary = 0;
  162. boolean hasQB = false;
  163. boolean hasTE = false;
  164.  
  165. System.out.println("Welcome to Fantasy Football!");
  166. System.out.println("\nYour offensive line will require the following:");
  167. System.out.println("\t1 Quarterback (QB)");
  168. System.out.println("\t1 Tight End (TE)");
  169. System.out.println("\t2 Running Backs (RB)");
  170. System.out.println("\t2 Wide Receivers (WR)");
  171. System.out.println("\nYour salary cap is $30 million");
  172. System.out.println("\nYou need a minimum of 6 players; max is 10 players.");
  173.  
  174. while ( players <= 10 && salary <= 30000000 )
  175. {
  176. Scanner keyboard = new Scanner(System.in);
  177. System.out.println("\nEnter your team name: ");
  178. String teamName = keyboard.nextLine();
  179.  
  180. System.out.println("Would you like to enter player data?: (y/n)");
  181. char response = keyboard.next().charAt(0);
  182.  
  183. if (response == 'y')
  184. {
  185. System.out.println("Enter player's name: ");
  186. String playerName = keyboard.nextLine();
  187. System.out.println(playerName + "'s position: (qb, te, rb, wr)");
  188. char position = keyboard.next().charAt(0);
  189. if (position == 'q')
  190. {
  191. if ( QB == 0 )
  192. {
  193. hasQB = true;
  194. players++;
  195. QB++;
  196. }
  197. else if ( QB == 1 )
  198. {
  199. System.out.println("You have reached the limit of Quarterbacks on your team! Restarting...");
  200. return;
  201. }
  202. }
  203. if (position == 't')
  204. {
  205. if ( TE == 0 )
  206. {
  207. hasTE = true;
  208. players++;
  209. TE++;
  210. }
  211. else if ( TE == 1 )
  212. {
  213. System.out.println("You have reached the limit of Tight Ends on your team! Restarting...");
  214. return;
  215. }
  216. }
  217. if (position == 'r')
  218. {
  219. if ( RB <= 3)
  220. {
  221. players++;
  222. RB++;
  223. }
  224. else if ( RB == 4 )
  225. {
  226. System.out.println("You have reached the limit of Running Backs on your team! Restarting...");
  227. return;
  228. }
  229. }
  230. if (position == 'w')
  231. {
  232. if ( WR <= 3 )
  233. {
  234. players++;
  235. WR++;
  236. }
  237. else if ( WR == 5 )
  238. {
  239. System.out.println("You have reached the limit of Wide Receivers on your team! Returning...");
  240. return;
  241. }
  242. }
  243. System.out.println("Enter " + playerName + "'s salary: ");
  244. int salary1 = keyboard.nextInt();
  245. salarytotal += salary1;
  246. System.out.println("\nWould you like to enter another player? (y/n)");
  247. char response1 = keyboard.next().charAt(0);
  248. {
  249. if ( response1 == 'n' )
  250. {
  251. System.out.println(teamName);
  252. System.out.println("\tSalary: $" + salarytotal);
  253. System.out.println("\t" + players + " players");
  254. if (hasQB == false)
  255. {
  256. System.out.println("\tNo Quarterback");
  257. }
  258. if (hasQB == true)
  259. {
  260. System.out.println("\tQuarterback");
  261. }
  262. if (hasTE == false)
  263. {
  264. System.out.println("\tNo Tight End");
  265. }
  266. if (hasTE == true)
  267. {
  268. System.out.println("\tTight End");
  269. }
  270. System.out.println("\t" + RB + " Running Backs");
  271. System.out.println("\t" + WR + " Wide Receivers");
  272. if ( players <= 5 || players >= 11 || salarytotal <= 30000000 )
  273. {
  274. System.out.println("\n" + teamName + " does not meet team requirements.");
  275. return;
  276. }
  277. else if ( players >= 6 || players <= 10 || salarytotal > 30000000 )
  278. {
  279. System.out.println("\n" + teamName + " meets team requirements.");
  280. return;
  281. }
  282. salary = 0;
  283. WR = 0;
  284. TE = 0;
  285. QB = 0;
  286. RB = 0;
  287. }
  288. }
  289. if (response == 'n')
  290. {
  291. System.out.println("test");
  292. return;
  293. }
  294. }
  295. }
  296. }
  297. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement