Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This looks good. Now you want to start timing it. Import java.util.concurrent.TimeUnit; then create variables long startTime = 0; long endTime = 0; long[] duration

This looks good. Now you want to start timing it. Import java.util.concurrent.TimeUnit; then create variables long startTime = 0; long endTime = 0; long[] duration = new long[iter]; long maxTime = 0; long placeholder = 0; int max_index = 0; // finish where I put comments Scanner scan = new Scanner(System.in); String passwordGuess = ""; System.out.print("Enter your password: "); String password = scan.nextLine(); String guess = ""; for (int n = 5; n <= 11; n++) { // another for loop (lets to 10 times at first but may need to get up to like 100) guess = generateRandomString(n); //stat time if (guess.length() == password.length()) { break; } //end time // save end time - start time into index in duration array // end loop placeholder = getMaxValue(duration); // I created the getMaxValue for you // if placeholder is greater the maxTime // then max_index should be set equal to i // and maxTime should be set equal to placeholder } int c = 0; for(int i = 0;i maxValue) { maxValue = array[i]; } } return maxValue; }

* I have been tasked to c_reate a program that guesses a password and implements timing when guessing the password. This is my code so far without the timing implemented. I am supposed to finish the code off by creating the following variables as per the comments within the code. All help is greatly appreciated!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions