Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In Java Objectives After successfully completing this assignment you will be refreshed on how to work with loops and String methods. Assignment Develop a program

In Java

Objectives

After successfully completing this assignment you will be refreshed on how to work with loops and String methods.

Assignment

Develop a program named Wheel.java which simulates a simple Wheel of Fortune style word game. Your program will prompt the user for a phrase, then create and print a puzzle with blanks in place of letters, and punctuation filled in. The program will then prompt the user to guess letters until the puzzle is solved. Develop the complete program in the main method.

Here's a sample run (user input in red) :

Enter a phrase: Westward, Ho! _ _ _ _ _ _ _ _ , _ _ ! Guess a letter: E _ E _ _ _ _ _ _ , _ _ !

Guess a letter: s _ E S _ _ _ _ _ , _ _ ! Guess a letter: t _ E S T _ _ _ _ , _ _ ! Guess a letter: w W E S T W _ _ _ , _ _ ! Guess a letter: a W E S T W A _ _ , _ _ ! Guess a letter: r W E S T W A R _ , _ _ ! Guess a letter: n W E S T W A R _ , _ _ ! Guess a letter: o W E S T W A R _ , _ O ! Guess a letter: h W E S T W A R _ , H O ! Guess a letter: d W E S T W A R D , H O ! Hooray! It took you 10 guesses.

Hints and tips

This is the hardest project you have had so far this semester. It's essential that you break it into pieces. You should spend some time thinking about your algorithm before coding. Once you start coding, get some small piece of it to work before adding other parts.

The puzzle in this example was created with underscore character _. If you put several underscore characters together, they look like a line, like so: ________. So, a space was put in between every character of the original phrase input by the user, like so: _ _ _ _ _.

Notice that in this example, the puzzle is all uppercase, no matter what the user types in. Likewise, if the user guesses a lowercase letter, it matches uppercase letters. You'll save yourself some trouble if you convert all input to uppercase as soon as you read it in.

Uppercase letters have an order, and they are consecutive. 'A' is less than 'Z'. A char is a primitive data type, and thus can be compared using the equality operators, <, >, <=, >=, and ==.

In Java, Strings are immutable. That means they can't be changed. You can create new Strings, and assign them to a variable, but you can't change an existing String.

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

Beginning ASP.NET 2.0 And Databases

Authors: John Kauffman, Bradley Millington

1st Edition

0471781347, 978-0471781349

More Books

Students also viewed these Databases questions

Question

=+What is the big message you want them to know?

Answered: 1 week ago

Question

=+What do they (audience members) currently think?

Answered: 1 week ago