Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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.

Step by Step Solution

3.49 Rating (162 Votes )

There are 3 Steps involved in it

Step: 1

Answer Please find the below code Complete code after PART C SecretPhrasejava import javaxswing import javaioFile import javaioFileNotFoundException import javautilArrayList import javautilRandom impo... 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

Recommended Textbook for

Discovering Advanced Algebra An Investigative Approach

Authors: Jerald Murdock, Ellen Kamischke, Eric Kamischke

1st edition

1559539844, 978-1604400069, 1604400064, 978-1559539845

More Books

Students also viewed these Programming questions

Question

1. List and describe the various subjective elements of culture.

Answered: 1 week ago