Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

--------------------------------------------------------------------------------------------------------------------- Here is the shell I need to fill in: import java.io.*; import java.util.*; public class WordGameShell { public static void main(String[] args) throws FileNotFoundException

image text in transcribed

---------------------------------------------------------------------------------------------------------------------

Here is the shell I need to fill in:

import java.io.*; import java.util.*; public class WordGameShell { public static void main(String[] args) throws FileNotFoundException { //declare two arrays of String with the size 20 //call the method description //call the method fillArray //call the method play } public static void description() { } /*this method reads the file and fills in the array*/ public static void fillArray(String[] correct, String[] incorrect) throws FileNotFoundException { //create two file objects with the .txt file that you have //use scanner object to fill in the arrays } public static void play(String[] correct, String[] incorrect) { Scanner keyBoard = new Scanner(System.in); int point = 0; int correctAnswer = 0; String answer; int randnum = 0; int list = 0; //chooses if the word will be from the correct or incorrect list String replay = "y"; int replayCorrect = 0; int timesplayed = 0; String repeat = "y"; Random random = new Random(); while(repeat.equalsIgnoreCase("y")) { // timesplayed = 0; while(replay.equals("y")&& timesplayed  

----------------------------------------------------------------------------------------------------------------------

Please if you can include comments(Not the ones already provided in the shell) on how each method and non obvoiuse coding works or creates I would appreciate it.

Problem: you are to write ajava program allowing the user to play a word game. There should be two different lists of words: aset of misspelled words and a set of words spelled correctly. Here are the steps to play the game: l. Your program randomly selects a word from the list (it could be a word that is misspelled or a word that is spelled correctly. 2. The word will be displayed to the user 3. User needs to decide ifthe word is spelled correctly or not 4. If the user's answer is correct then he'she will gain one point otherwise he'she will lose a point 5. Ask the user if he/she wants to play again 6. If the answer is no, display the score 7. If the answer is yes go to the step 1. How to write your program: l. You can use arrays of strings to store the words. How many arrays do you need? 2. You need to have two files for the words: Misspelled words and correct words 3. Filling in you arrays by reading from the files 4. Use a variable to keep track of the score 5. The randomly selected word cannot be repeated. Therefore you need to keep track of the words already shown to the user. 6. Use the scanner class to interact with the user. 7. Use the Random class to generate random numbers to pick a word from the list. How many random numbers do you need? You need two random numbers but why? 8. Use while loop to repeat the game as long as the user is interested. Requirements 1. Write a method for displaying the description of your program 2. Write a method for filling in the array from the files 3. Write a method called play 4. Write the algorithm for this program before start coding 5. Provide a description of your program. 6. You must use methods in your program. 7. Appropriate identifier naming S. Comments 9. Proper indentation 10. Follow the naming conventions

Step by Step Solution

There are 3 Steps involved in it

Step: 1

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

Databases Illuminated

Authors: Catherine M. Ricardo

1st Edition

0763733148, 978-0763733148

Students also viewed these Databases questions