Question: Write a Java Program called Lab19.java that check to see how long it takes to generate a given word (to save time, maximum word length

Write a Java Program called Lab19.java that check to see how long it takes to generate a given word (to save time, maximum word length 6)

Program Skeleton

import java.util.*;

public class Lab19 {

public static void main(String[] args) {

// TODO code application logic here

// input a word (max 6 characters)

Scanner in = new Scanner(System.in);

String word;

do {

System.out.println("Enter a word, max 6 chars");

word = in.nextLine();

} while (word.length() > 6);

long startTime = System.currentTimeMillis();

String s="";

// generate the initial String

while ( !s.equals(word))

{

// Generate the next word

}

long endTime = System.currentTimeMillis();

long time = (endTime - startTime)/1000;

System.out.println(time);

}

// generate a random lowercase character

public static char generate(){

}

}

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!