subject
Computers and Technology, 04.03.2020 02:01 1lowz1k

Design and implement a word unscrambler game in Java.

Instructions
Your program should read in a random word from a file called words. txt (note the lack of capitalization) that you provide. The file should contain:

One word per line

At least 10 different words

Each word should have at least 5 letters

Words should have variable lengths

To read a random word you can generate a random number between 1 and the number of lines, and skip n-1 lines before reading the word. Scramble the word by swapping random pairs of letters a random number of times (mandatory use of a loop). Display the scrambled word with character indices on top. Offer the user a menu with the following choices:

Enter 1 to swap a pair of letters

If this option is selected, prompt the user to enter two indices and swap the letters. A space should separate the two indices. Print an error message if the indices are invalid. If the word is unscrambled successfully, print a congratulatory message containing the word and the number of steps it took to unscramble. Otherwise, display the new word and offer the menu again.

Enter 2 to solve

If this option is selected, print the unscrambled word and quit.

Enter 3 to quit

If this option is selected, quit.

ansver
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 21.06.2019 18:30, RoxanneDuartee
Which statement best explains how plant cells use photosynthesis to maintain homeostasis? they use glucose and water to make energy. they break down glucose into fat. they combine oxygen and water to make glucose. they make glucose from carbon dioxide and water.
Answers: 1
image
Computers and Technology, 22.06.2019 10:30, JeroMii
Think about a recent customer service experience - either positive or negative. write a brief summary of that experience. now think about those four characteristics we look for in customer service representatives. how did the representative in your example stack up? write down your answer and give specific examples.
Answers: 1
image
Computers and Technology, 23.06.2019 03:30, bellsbella34
Ihave a singular monitor that is a tv for my computer. recently, i took apart my computer and put it back together. when i put in the hdmi cord and booted the computer to see if it worked, the computer turned on fine but the screen was blue with "hdmi no signal." i've tried everything that doesn't require buying spare parts, any answer is appreciated!
Answers: 1
image
Computers and Technology, 23.06.2019 18:30, sawyerfauver
The computers in the sales department did not have enough data storage capacity to contain all the information the department needed to store, and it was taking a long time for team members to access the data they needed. to fix the problem, the technician installed new, larger hard drives on all the computers.
Answers: 1
You know the right answer?
Design and implement a word unscrambler game in Java.

Instructions
Your program...

Questions in other subjects:

Konu
Mathematics, 06.07.2019 16:30