Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Students also viewed these Programming questions

Question

What is the difference between a primary and a secondary market?

Answered: 1 week ago

Question

Which period is known as the chalolithic age ?

Answered: 1 week ago

Question

Explain the Neolithic age compared to the paleolithic age ?

Answered: 1 week ago