Answered step by step
Verified Expert Solution
Question
1 Approved Answer
You may have a combination lock on your locker at school where you have to spin the dial to 3 separate numbers from 0 up
You may have a combination lock on your locker at school where you have to spin the dial to separate numbers from up to What if you forgot your combination? Would you be able to guess it
Write code that will generate random integers from up to but not including using Math.random in the Active Code window below. Run it a couple times to see it generate different numbers.
How many times would you need to run it to guess your combination correctly? Let's have the code compute the number of permutations possible in your combination lock using Math.pownumberexponent For example, if you had dials on your combination lock where each dial can be set to a digit from digits there are possible permutations. In Java, this would be written as Math.pow which means to the power of If you start listing all the permutations possible, you can tell that there are or possible permutations for a dial lock from
dots
Now what about the combination lock for this challenge? It has dials with not including numbers possible on each dial. In general, the formula to use is NumbersPerDialnumberOfDials. Write this using the Math.pow method in your code and save it into a variable and print out.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started