Design and implement a word unscrambler game in Java. Project Details:Write a program namedWordUnscrambler.java that reads in a random word from a file called words.txt (note the lack of capitalization) thatyou provide. The file should contain one word per line. 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 theword by swapping random pairs of letters a random number of times. Display the scrambled word with character indexes 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 indexes and swap the letters. Print an error message if the indexes 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.Examplerun:0123456rpocjetEnter 1 to swap letters.Enter 2 to solve.Enter 3 to quit.1Enter the indexes separated by spaces0 10123456procjetEnter 1 to swap letters.Enter 2 to solve.Enter 3 to quit.1Enter the indexes separated by spaces3 420123456projcetEnter 1 to swap letters.Enter 2 to solve.Enter 3 to quit.1Enter the indexes separated by spaces4 5Congratulations! You unscrambled the word project in 3 steps.Formatting
CSC220
[Solved] CSC220 Project 2- Word Unscrambler Game
$25
File Name: CSC220_Project_2-_Word_Unscrambler_Game.zip
File Size: 367.38 KB
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.