1. Find the JAVA code for Hangman. I need it without using applet and swing, just need it in command prompt. (Hangman)2. Find the week7. I did some part, please complete it (week7 pdf and oddcalculator

- Attachment 1
- Attachment 2
- Attachment 3

Week 7 Pair Exercise – Odds Calculator You volunteer your weekends at 305-‐Gambler, an anonymous helpline. After answering a few phone calls you start to realize that your callers have no idea what their probabilities for winning their games actually are. You decide on a strategy for counseling that introduces long-‐shot odds in order to establish a baseline for comparison to the odds they actually have in their game of choice. Some of these long-‐shot odds are: • The odds of being struck by lightning is 1 in 2,000,000; at all during your lifetime is 1 in 3,000. • The odds of dying due to an asteroid impact is 1 in 200,000. • The odds of finding a pearl in an oyster you are eating is 1 in 12,000. • The odds of becoming a professional football player, assuming you played in high school, is 8 in 10,000. • Under normal circumstances the odds of having identical twins is 3 in 1,000; quadruplets is 1 in 705,000. • The odds that the Dolphins will win the next super bowl is 1 in 80. You noticed that the most common addiction was to the state lottery system. These vary widely in how they are played and so you want a program that takes input and does it for you automatically. To establish a valid calculation of the caller’s odds you decide to write a program that asks for the range of numbers (example: 1 – 52), and how many numbers are drawn (for example: 6 numbers) in their game of choice. It will also ask whether or not the order that the numbers are drawn matters. Your task is to create a program that will calculate the odds based on three inputs: (1) the range of numbers, (2) the count of numbers drawn from this pool, (3) whether the order matters (i.e. if the drawing was 1, 2, 3 but your bet was for 3, 2, 1 you actually lost). After calculating the odds, it will print out the odds that were calculated, and any of the comparisons presented above that are actually more favorable than those odds that were just calculated. Use the following as an example: Example -‐ The Florida Lottery: 1. The range is 53 numbers. 2. There are 6 numbers drawn. 3. The order does not matter. Using this example, the odds for the first ball being drawn is 1/53. Since there is now one less ball the odds for the second number is 1/52. Since there are now two less balls the odds for the third number is 1/51, and so on until the odds for the sixth and final number is 1/48. The odds are therefore 53 * 52 * 51 * 50 * 49 * 48 = one in 16,529,385,600. If order did matter, you stop here and these are the odds calculated (what your program should output). However, the order does not matter. So in this case, you must eliminate all the possible combinations for those 6 numbers. Possible combinations are (6!) which is 6 * 5 * 4 * 3 * 2 * 1 = 720. You divide the original calculation by this number to get the final probability. The final result is 16,529,385,600/720 = 22,957,480. Your program will print out that the odds for winning this game is 1 in 22,957,480. The program will then print out any of the odds above, which are actually less than the calculated odds. In this case, every single one is lower so all of them would be printed to screen. Requirements: • The program will ask for an integer number to indicate the range of numbers in the game. (How many balls are in the hopper?) o The program will verify that this number is not negative, and if it is it should continue prompting the user until a valid input is provided. • The program will ask for the count of numbers to be drawn. (How many balls are drawn from the hopper to be the winning set?) o You cannot draw a negative number of numbers, and you also can’t draw more than you have so the program will verify that this number is not negative, and is also less than the range. It will continue prompting the user until a valid input is provided. • The program will then ask if the order matters as either (yes or no) or (true or false). o You must validate that they put in valid input. If they did not, you will continue prompting the user until a valid input is provided. • The program will then calculate the exact odds based on these three inputs and print them to screen. • The program will also then output any of the statements above, which are actually lower odds than those that were calculated. Instructions: 1. You may work with a “coworker” on this exercise, or choose to do it alone. 2. First, work through on paper exactly what the requirements are asking you to do. 3. Once have worked through the requirements on paper, then code. 4. When you have finished, upload the project file to the Blackboard Week 7 pair exercise dropbox as a zipped file with the following name: “Pair7_Student1_Student2.zip” Some sample input and corresponding output: