create a game that randomly selects a phrase from the file and allows the user to guess
Question:
create a game that randomly selects a phrase from the file and allows the user to guess the phrase letter by letter.
Modify the above game so that the game is composed of more than one rounds (number of rounds can be defined and set as a constant variable in the program). In each round (like part A) the program asks the user to guess a new phrase. It keeps the score of users for each round which is calculated by the length of the phrase divided by the number of user’s guesses. When all rounds are done, the program must show the average score and a tabular report of all rounds and its related score and phrase. For example, the partial output of a run of 5 rounds is as follows: (Using GUI is optional) Round Target Phrase Score 1 The Wizard of Oz 1.23 2 Gone With The Wind 1.64 3 Casablanca 1.25 4 Chicago 0.88 5 Top Hat 1.17 The average score is 1.23
Use command-line arguments to make your code flexible for running different parts as shown in the following main method.
Using java SercetPhrase 1 -l command will execute exercise 2 in Assignment 4. Using java SercetPhrase 1 -f filename command will execute part A of this assignment. Using java SercetPhrase 10 -l command will execute 10 rounds of exercise 2 in Assignment 4 in 10 and finally reports the scores detail and average score (like what is shown in part 2). However, if user runs the java SercetPhrase 5 -f filename command, the program executes 5 rounds of a game where it selects its random phrases from a file named as the filename. (Part B) Finally, if the user tries to run the program with no argument like java SercetPhrase the program must display the usage instruction and ends.
Discovering Advanced Algebra An Investigative Approach
ISBN: 978-1559539845
1st edition
Authors: Jerald Murdock, Ellen Kamischke, Eric Kamischke