1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
vova2212 [387]
2 years ago
8

8.10.8 guess the passcode codehs

Computers and Technology
1 answer:
harkovskaia [24]2 years ago
7 0

Answer:

sorry its late

Explanation:

/*

* Write a program that guesses every possible 4 digit passcode

* combinations until the correct passcode is guessed.

*

* The passcode is randomly generated and stored in the variable

* secretPasscode.

*

* Print out how many guesses it took to guess the correct passcode.

*/

function start() {

   var correctCode = generateRandomPasscode();

   var b = 0;

   while(true){

       var guessCode = generateRandomPasscode();

       b++;

       if(isCorrect(guessCode, correctCode)){

           println("The correct passcode was " + guessCode);

           println("It took you " + b + " tries to guess it");

       break;

       }

   }

}

function isCorrect(guessCode, correctCode) {

   return guessCode == correctCode;

}

function generateRandomPasscode() {

   var randomPasscode = "";

   for(var i = 0; i < 4; i++) {

       var randomDigit = Randomizer.nextInt(0, 9);

       randomPasscode += randomDigit;

   }

return randomPasscode;

}

You might be interested in
PLEASE ANSWER LAST DAY OF SCHOOL. Discussion Topic
meriva

Answer:

You can't really say it matters whether it's short or long

Explanation:

There several coding language some short and some long with different purposes so it doesn't really make a difference

Although some coders have been able to shorten some codes so I'd say shorter is faster and be[er and easier to memorize

Thanks hope I was helpful

4 0
2 years ago
Convert the following MIPS instruction to its binary and hex representations by doing the following: On first line, type registe
Firdavs [7]

Answer:

To make the group of four we can write 100011 as 00100011

Now, the two groups are:- 0010 and 0011

And 0010 in binary corresponds to 3 in Hexadecimal

And 0011 in binary corresponds to 4 in Hexadecimal.

So, 100011 of binary corresponds to 34 of hex.

3 0
4 years ago
Lewis wrote an informational academic paper about deer. He rereads his work and is starting to revise for academic voice.
Anna [14]

Answer: C. Some people think they can tame deer, but I just don’t buy it.

5 0
2 years ago
Read 2 more answers
1. Which utility would you use to return the common name of the computer you are at?
melamori03 [73]

The utility you would use to return the common name of the computer you are at is Ping.exe. This is the one of the utility which are in first command line utilities. It's easy, first you need to open cmd.exe then you should enter ping-your ip adress, this reveals the TCP/ICP name of the computer you are at.

5 0
4 years ago
Which best describes the education and training cluster?
kicyunya [14]
3 workers because that explains the question the best
6 0
4 years ago
Read 2 more answers
Other questions:
  • Ann. An employee in the payroll department, has contacted the help desk citing multiple issues with her device, including: Slow
    7·1 answer
  • Being technologically literate requires being able to ______.
    11·2 answers
  • A user found that their personal data had been exfiltrated from their computer by a malicious program that they clicked on sever
    12·1 answer
  • A technician suspects a network card is not working. Which tool should the technician use to test the network card?
    14·1 answer
  • What controls network connectivity such as Wi-Fi and the GPS locator in a mobile device?
    8·1 answer
  • Network administrators use _______ technology to get antivirus updates to be automatically downloaded on employees' workstations
    15·1 answer
  • Write a program that accepts three decimal numbers as input and outputs their sum.
    10·1 answer
  • Help I will mark brain list I promise!!
    5·1 answer
  • Who plays pokemon shield or sword
    8·2 answers
  • Select the correct answer.
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!