Question: C# ONLY PLEASE C# ONLY C# ONLY Background: Word guessing games are a very common childhood activity. Typically you are told how many letters are

C# ONLY PLEASE C# ONLY C# ONLY Background:
Word guessing games are a very common childhood activity. Typically you are told how
many letters are in the word, and then you guess letters. Letter by letter, you either see
more of the word, or you run up against a deadline. Examples of these games are
apple tree, hangman, and even the TV show Wheel of Fortune.
You have decided to go try out for Wheel of Fortune, but you want to put your new found
coding skills to the test first. You are going to write a helper program, which will help
you guess the correct words.
This program will ask you how many letters are in the word, then itll ask you to give it
some letters that you know, and itll show you all the possible words of that length with
those letters.
There are two different ways that you might want to use it. For example you might want
to find all words which have the letters o and p in them in any order. Top being an
example, Pot being another. But you might also want to be able to find words with a
particular pattern in them, for example, all words with pp in them (such as happy).
In order to simplify this, we are going to use a dictionary of the 900 most common words
in English. When we get to the FileIO Module in a few weeks, you could modify this to
load in a full dictionary which would have 100,000+ words. Then it would be even more
powerful, but even with the 900 most common words, itll help a lot.
Your tasks:
1) In the zip file with these instructions, you also were given an English.java and an
English.cs file. If you are a java student you only need English.java, if you are a
C# student you only need English.cs.
2) Import the appropriate file into your project (either copy/paste, or import the file).
You do not need to change anything in this class, so dont modify any code in
there.
3) In your main class, write the following methods:
a) wordContainsLetter. It should take in a word (String) and a letter (char)
and it should return a boolean which is true if the word contains that letter,
or false if not.
There are many ways to do this, but the simplest is to use a foreach loop
that iterates over the String as if its an array of characters. Both C# and
Java have a string method called toCharArray which converts a string to
an array of characters. It may be helpful.
b) wordContainsString. It should take in two strings, and determine if one
string is in the other. For example if given happy and pp it should
return true. If given happy and ab it should return false. It should only
return true if the entire second string is in the first string. Both languages
have methods for doing this. Check out the docs for String objects here
and look for a useful method:
c) guessWordWithLetters. It will take in an English object, a length and a
string of letters. For example, you might be passed the English Object, 3
and at. Youll then look for all words that are 3 letters long, that have an
a and a t in them and print them out (e.g. tax, art and eat). It will return
void.
What you will want to do here, is iterate over every word in the English
objects words list/arraylist. As you look at each word, youll decide if its
the right length, then youll check each of the letters that were passed in to
see if they are in the word. If its the right length and all the letters are in
there, print it out, otherwise move onto the next word.
d) guessWordWithPattern. It will take in an English object, a length, and a
pattern (string). For example you might be passed the English Object, 3
and ct. This will only print words which have c followed by a t in them.
Again this method returns void.
4) Finally, youll write a driver in your main class. It should do the following:
a) Prompt the user to enter the length of the word they are looking for How
many letters are in the word?
b) Read in the response.
c) Prompt the user with a menu asking if they want to search for letters, or by
pattern. It should read:
Do you want me to look for letters or a pattern?
1. Letters
2. Pattern
d) Read in the user's response. If they choose 1, ask them for the letters
What letters are in the word?. Now call guessWordWithLetters, passing
the appropriate arguments. If they choose 2, ask for the pattern What
pattern is in the word?. Now call guessWordWithPattern, passing the
appropriate arguments.
In either case print out It might be any of these...
Sample Output:
User input in bold
How many letters are in the word?
3
Do you want me to look for letters or a pattern?
1. Letters
2. Pattern
1
What letters are in the word?
at
It might be any of these...
act
art
eat
tax
Second Run:
How many letters are in the word?
5
Do you want me to look for letters or a pattern?
1. Letters
2. Pattern
2
What pattern is in the word?
pp
It might be any of these...
apply
happy PLEASE SHOW CODE TO THIS IN C#

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!