Question: Based on the method descriptions below, how can I pass the Scanner from the main() method to the promptUserForSeed() method, and how can I use

Based on the method descriptions below, how can I pass the Scanner from the main() method to the promptUserForSeed() method, and how can I use the long variable that the promptUserForSeed() method returns as the seed that gets passed to the findWords() method? I'm just having trouble figuring out how I can pass these variables on to these other methods that need to use them. Thank you!

Method Descriptions:

public static void main(String[] args)- Your main method should create a new Scanner object to read from the keyboard, pass the scanner to promptUserForSeed(), and use the long that it returns as the seed that gets passed to findWords(). Print out the WordBoard that you receive from findWords(), and then use WordBoard's checkAnswers() method to see if your code works as expected.

public static long promptUserForSeed(Scanner input)- This method should print a prompt to the user asking them to input a seed. Read in their input using input.nextLong() and return that value. You do not need to account for the user inputting invalid seeds.

public static WordBoard findWords(int rows, int cols, long seed)- This method should contain the bulk of your code. Using the given seed and dimensions, create a new WordBoard object, fetch the 2D array that WordBoard has generated, and perform your word search on that 2D array. Whenever you find a word, use the highlightWord() method to tell the WordBoard that you've found it. Return the WordBoard object once you are finished finding all of the words.

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 Programming Questions!