Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a program that will let the user play Hangman. Setup Your program should p

ID: 642666 • Letter: W

Question

Write a program that will let the user play Hangman.

Setup

Your program should prompt the user to enter a word. If the user enters a word, that will be the word the player guesses.

If the user does not enter a word (i.e. they enter the empty string) you should prompt them for a URL. This URL will point to a page containing one line, a comma-separated list of words. You should use Random to select a word from the list.

Hint: Determine how many words are in the list, use this to select a random number in the appropriate range and index the list with the random number.

You may test with the following URL: https://cs1110.cs.virginia.edu/hangmanwords.txt

Suggested Approach

Create a display string with the right number of hyphens (loop and add one for each letter in the target word).

For each letter they guess,

If the letter is not in the target word, count a miss (the String class

Explanation / Answer

hangman.h

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote