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
You're the administrator for a large bottling company. At the end of each month, you routinely view all logs and look for discre
Natali [406]

Answer:

It seems as though it would be a DDoS attack.

Explanation:

The characteristics are as follows:

A slow down of operations and attempting to get access into said service.

4 0
3 years ago
Is a display, or monitor, considered a piece of computer hardware
9966 [12]
Yes. The monitor is considered as a piece of Computer Hardware. Computer hardware is what you can physically touch, like the keyboard, mouse, monitor, disk drive, and so on.

I hope this answers your question.

Thank you,
Otaku
3 0
3 years ago
Is the very calculation that we wish to avoid. Obtain a second equation by multiplying both sides of this equation by 1.06, then
Over [174]

Answer:

The answer is given in the attachment

Explanation:

3 0
3 years ago
1.
kenny6666 [7]
1. true
2. false
3. true
4. true
5. true

if you would like an elaboration, let me know 
8 0
3 years ago
William wants to create a document using a DTP. What time-saving techniques can he use?
Verdich [7]
Projective ecodynamic blueglocose
6 0
4 years ago
Other questions:
  • What is the portrait mode?
    5·2 answers
  • After typing “application letter” in the Search window in the New dialog box, Nate clicks the Education category. Three letters
    9·1 answer
  • Acomputer with a domain name is called a
    8·1 answer
  • 24. The central processing unit (CPU) consists of two parts which are a. the input and output devices b. the control unit and th
    13·1 answer
  • What are the pros and cons of the internet’s ability to access information
    8·2 answers
  • Where can I watch all harry potter movies for free?
    7·1 answer
  • On the Audio Tools contextual tab, which tab will control how the audio file appears, if it appears, on the slide itself?
    8·2 answers
  • What are the possible consequences of plagiarism?
    15·1 answer
  • Which of the following factors is least likely to result in delivery delays?
    7·1 answer
  • Online advertising includes: a. All of these are correct. b. ads in print newspapers. c. social media. d. listings on directory
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!