Question: I need help with this assignment as soon as possible. Would greatly appreciate it. Language is Java. You get a job as a magician's assistant.

I need help with this assignment as soon as possible. Would greatly appreciate it. Language is Java.

You get a job as a magician's assistant. One magic trick that the magician has in their show the Secret Digit. In this trick the magician brings an audience member onto the stage. He then: 1. Asks then to think of 4 digits (keeping them secret) 2. Asks them to make two numbers with those digits (keeping them secret) 3. Asks them to subtract the smaller number from the larger number (keeping the result secret) 4. Asks them to choose any digit in the difference except 0 (keeping it secret) He then asks the audience member to tell him the remaining three digits and magically tells the audience member the missing digit from step 4 above. What the magician does not tell the audience is that you can talk to him through a hidden earpiece and that you tell him the missing digit. In this assignment you are to write a program that will calculate the missing digit so you can communicate it to the magician. Sample Input/Output Example #1: 1 9 9 The missing digit is: 8 Example #2: 5 7 8 The missing digit is: 7 Example #3: 4 2 1 The missing digit is: 2 I know that this assignment can be a bit confusing: Let's walk through the steps as if we were playing this game in person: 1. I think of a 4-digit number, let's assume I think of 1234 2. I think of two combinations of the digits in that number, let's assume I think of 4132 and 2134 3. I subtract the smaller from the larger (4132 - 2134) that gives me 1998 4. I tell you any three of the digits in that number, let's assume I tell you 1, 9, 9 5. You tell me that the missing digit is 8 HINT: It doesn't matter what two numbers the user is thinking of. What matters is the three ints that they enter. From those three ints you should be able to determine the missing integer. For example: User enters 1, 2, 3 : the missing integer is 3 User enters 1, 1, 1 : the missing integer is 6 User enters 7, 6, 1 : the missing integer is 4 User enters 9, 1, 3 : the missing integer is 5 Do you see a pattern? The missing digit is the number that must be added to the sum of the three digits entered by the user to get a number that is evenly divisible by 9.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!