System.out.println(""}; Collections.shuffle (words); Scanner scanner = new Scanner (System.in); for (String w : words) { String scrambledWord = scramble (w) ; System.out.print (scrambledWord + " = ?...


I am doing a project that consists of creating a word scramble game with a text file where the program gives the user scrambled words and the user must correctly guess the word. I have finished most of the code, however, I am having trouble understanding the code to scramble the words that are asked.


System.out.println(

Extracted text: System.out.println(""}; Collections.shuffle (words); Scanner scanner = new Scanner (System.in); for (String w : words) { String scrambledWord = scramble (w) ; System.out.print (scrambledWord + " = ? ") ; String guess = scanner.next () ; if (guess.equalsIgnoreCase (w) ) { System.out.println ("You Got It!"); } else { System.out.println ("Game Over! :("); return; } System.out.println (""); System.out.println ("Congratulations! You Won The Game! :D"); scanner.close (); private static String scramble(String word) { // TODO: Scramble the word before returning return word;
|-<br>/*<br>2<br>* To change this license header, choose License Headers in Project Properties.<br>To change this template file, choose Tools | Templates<br>3<br>4<br>* and open the template in the editor.<br>5<br>*/<br>6<br>package wordscramble;<br>7<br>8 E import java.io.IOException;<br>9<br>import java.nio.file.Files;<br>10<br>import java.nio.file. Paths;<br>import java.util.Collections;<br>import java.util.List;<br>11<br>12<br>13<br>import java.util.Scanner;<br>14<br>15 -<br>/**<br>16<br>17<br>* @author chris<br>18<br>*/<br>19<br>public class WordScramble {<br>20<br>21<br>/**<br>22<br>* @param args the command line arguments<br>23<br>*/<br>public static void main (String[] args) throws IOException {<br>25<br>26<br>List<String> words = Files.readAllLines (Paths. get (

Extracted text: |- /* 2 * To change this license header, choose License Headers in Project Properties. To change this template file, choose Tools | Templates 3 4 * and open the template in the editor. 5 */ 6 package wordscramble; 7 8 E import java.io.IOException; 9 import java.nio.file.Files; 10 import java.nio.file. Paths; import java.util.Collections; import java.util.List; 11 12 13 import java.util.Scanner; 14 15 - /** 16 17 * @author chris 18 */ 19 public class WordScramble { 20 21 /** 22 * @param args the command line arguments 23 */ public static void main (String[] args) throws IOException { 25 26 List words = Files.readAllLines (Paths. get ("words.txt")); 27 System.out.println ("CSIS 212 Final Project - Christian Taylor"); 28 29 System.out.println ("Welcome to Word Scramble!"); 30 31 System.out.println ("Try to guess 10 words in a row to win the game !"); 32 33 34 System.out.println (""); 35 Collections.shuffle (words); 36 37
Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here