Write a Java program that will allow the user to play a hangman game repeatedly until they choose to stop. The game should randomly choose a secret word from a pre-set list of words for the user to guess. Store the list of words available for play in an array so you can randomly choose them by index during game play. During a turn, the user will guess one letter at a time. Each letter in the secret word should display as an asterisk until the letter is guessed by the user. When a correct letter is guessed, the letter should be displayed in the correct position in place of the asterisk. The user hangs himself with the 8th wrong guess and loses the game. Make a character array to hold the characters and asterisks representing the word being guessed. You can change the contents of this array as the letters are guessed and revealed. In other words, this array can be used to display the current state of the secret word each round. Here is the list of words the game should choose from for the secret word – technology, square, variable, program, documentation, and 5 additional words of your choice. At the end of the game, the user should have the ability to play again if they would like. Make sure you create appropriate methods to make your code efficient. Restrictions – you are only allowed to use primitive data types, Strings data types and arrays for this assignment. (Specifically, you are not allowed to use the StringBuilder class or Array class.) 1. You must use For loops in this lab. 2. You may not use the Array class or any of its methods in this lab. 3. If appropriate for this algorithm, you should validate any input from the user to make sure the data input is an appropriate value to work in your program’s logic. You don’t have to worry about validating that it is the correct data type. For now, assume the user is only giving you the correct data type and just worry about validating the value given is usable in your program

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a Java program that will allow the user to play a hangman game repeatedly until they
choose to stop. The game should randomly choose a secret word from a pre-set list of words
for the user to guess. Store the list of words available for play in an array so you can randomly
choose them by index during game play.
During a turn, the user will guess one letter at a time. Each letter in the secret word should
display as an asterisk until the letter is guessed by the user. When a correct letter is guessed,
the letter should be displayed in the correct position in place of the asterisk. The user hangs
himself with the 8th wrong guess and loses the game.
Make a character array to hold the characters and asterisks representing the word being
guessed. You can change the contents of this array as the letters are guessed and revealed. In
other words, this array can be used to display the current state of the secret word each round.
Here is the list of words the game should choose from for the secret word – technology, square,
variable, program, documentation, and 5 additional words of your choice. At the end of the
game, the user should have the ability to play again if they would like.
Make sure you create appropriate methods to make your code efficient.
Restrictions – you are only allowed to use primitive data types, Strings data types and arrays for
this assignment. (Specifically, you are not allowed to use the StringBuilder class or Array class.)

1. You must use For loops in this lab.
2. You may not use the Array class or any of its methods in this lab.
3. If appropriate for this algorithm, you should validate any input from the user to make
sure the data input is an appropriate value to work in your program’s logic. You don’t
have to worry about validating that it is the correct data type. For now, assume the user
is only giving you the correct data type and just worry about validating the value given is
usable in your program

Expert Solution
steps

Step by step

Solved in 5 steps with 5 images

Blurred answer
Knowledge Booster
Arrays
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education