Microsoft Visual C#
7th Edition
ISBN: 9781337102100
Author: Joyce, Farrell.
Publisher: Cengage Learning,
expand_more
expand_more
format_list_bulleted
Question
Chapter 6, Problem 10E
Program Plan Intro
- Create a class Program under namespace GuessAWord.
- Declare two variables wrongGuessChance and lettersLeft of type int.
- Define the following functions inside the class:
- Define a function getGuessWord: This function store eight words in array words and use Random class to pick a random word from this array and return it.
- Define a function hideWord: This function takes as input the randomly selected word and masks it by using asterisks.
- Define a function DisplayCharacters: This function displays the remaining unguessed letters of the guessing word.
- Define a function testGuess: This function takes the userLetter, word and characters array as a parameter. This function then uses for loop to check if the userLetter matches with any of the letters of guessWord. If yes it changes the masked guessWord, else it displays the message for the wrong guess and reduces the guessing chances.
- Define main functions and call the above functions in order to generate the guessing game.
Program Description: The following program will create a word guessing game named as GuessAWord.
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Pls, explain how this program question applies to the code below and comment on it in the program. for example, comment the which part of the question applies to the code and how it works
Use Java programming language
Write a program that asks the user to enter 5 test grades (use an array to store them).
Output the grades entered, the lowest and highest grade, the average grade, how many grades are above the average and how many are below and the letter grade for the average grade.
Create a method that returns the lowest grade.
Create a method that returns the highest grade.
Create a method that returns the average grade.
Create a method that returns how many grades were above the average.
Create a method that returns how many grades were below the average.
Create a method that returns the letter grade of the average (90-100 – A, 80-89 – B, 70-79 – C, < 70 – F)
Word Sleuth Puzzle Program
Chapter 6 Solutions
Microsoft Visual C#
Knowledge Booster
Similar questions
- Overview: Create a coin flip game that allows the user to guess whether the coin will be heads or tails. Save the data associated with the flip. Repeat for a total of 10 guesses/flips. Display result summary and details at end. Technical Requirements: Participant will guess whether a coin flip will result in Heads or Tails Computer will "flip" a coin to determine the side it lands using random generator import random at top of program result = random.randint(x,x) The program will display the results: Guess, Flip, Outcome (Match or No Match) The program will track the results and, when the game is over, display: Summary Detailed result of each turn Use parallel arrays to collect details from each turn that can be displayed as a table when the game is over Use running totals of each result detail to display at endarrow_forwardTranscribed Image Text JAVA Programming Problem: In the game of "Assassin's Creed", you control a ship with a cannon which is attacking a large enemy Assassin's Creed, armed with many guns. Your goal is to destroy as many of the guns as possible. The battle field is a 2D Cartesian grid, where your cannon is located at the origin. The enemy Assassin's Creed is a horizontal line segment located from the coordinates (X1, Y) to (X2, Y). There are exactly (X2 - X1 + 1) guns on the ship, located at the integer points (X1, Y), (X1+1, Y), ..., (X2, Y). However, the problem is, you cannot always fire at a gun. There are supernatural rocks located at all points of the battlefield whose X and Y coordinates are both integers. In order to fire successfully at an enemy's gun, the line connecting your cannon and that gun must not go through any rocks. Develop a JAVA code to output the number of the enemy battleship's guns that your cannon can destroy. Test Case Result 1 2 2 -2arrow_forwardWrite the program that has the following menu. This menu should continue to come up until the user selects Quit. 1) Add new user info. 2) Print complete report. 3) Print conditional report. 4) Sort the data by Name. 7) Quit (Option 1) If the user Selects option 1) Add new user info the following questions should be asked. After this information has been input the program should go back to the menu. This information should be stored in an array of records. Input Name -> Input Phone Number -> Input Salary-> 25000.00 (Option 2) // Use bubble sort If the user Selects option 2) Print complete report the following output should appear. This is an example report assuming three users were input. Name Phone Number Bob Tim Bob's Number Tim's Number Salary 25000.00 65000.95 (Option 3) If the user Selects option 3) Print conditional report the following question should be asked, followed by the report. This report assumes the same three user from above. Created by Paint S Print user with a salary…arrow_forward
- A positive integer greater than 1 is said to be prime if it has no divisors other than 1 and itself. Write a program that asks the user to input an integer greater than 1, then display all of the prime numbers that less than or equal to the number entered. The program should work as follows: • Once the user has entered a number, the program should display an array with all of the integers from 2 up through the value entered. • The program should then use a loop to step through the array. The loop should pass each element to a method that displays the element whether it is prime number. Your result should look like, for example: Enter an integer greater than 1: 9 2, 3, 4, 5, 6, 7, 8, 9 2 is prime 3 is prime 4 is not prime 5 is prime 6 is not prime 7 is prime 8 is not prime 9 is not prime Using java programmingarrow_forwardDice Roll: Generate random value from 1 to 6 and find the number of attempts after which 6 is obtained.Note: Just given the answer for 1 attempt, do notconfuse it with expected number of moves.arrow_forwardIf a circular array of size 5 contains the following at the beginning: Orange, Banana, Grapes, Apple, Peach. Give the content of the circular array after the following instructions: Dequeue(), Dequeue(), Enqueue(Watermelon), Dequeue(), Enqueue (Cherry) Select one: A.Orange, Banana, Grapes, Apple, Peach, Watermelon, Cherry B.Grapes, Apple, Peach, Watermelon, Cherry C.Orange, Banana, Grapes, Apple, Peach D.Watermelon, Cherry, Grapes, Apple, Peacharrow_forward
- check_game_over(): as the name suggests, this function should check to see if the game is over (if one side has no stones left in all of its pockets). It takes as an argument the game board and should return True if the game is over and False otherwise.arrow_forwardWrite the pseudocode for the following scenario. The final exam marks for 10 studentsare 65, 45, 78, 65, 89, 65, 79, 67, 75, and 63. The marks are stored in an array. Find:• The student with the highest mark.• The student with the lowest mark.• The total marks for all the students.• The overall average.arrow_forwardAssignment 5B: Keeping Score. Now that we know about arrays, we can keep track of when events occur during our program. To prove this, let's create a game of Rock-Paper-Scissors. For those not familiar with this game, the basic premise is that each player says "Rock-Paper- Scissors!" and then makes their hand into the shape of one of the three objects. Winners are determined based on the following rules: Rock beats Scissors Scissors beats Paper Paper beats Rock At the start of the program, it will ask the player how many rounds of Rock-Paper- Scissors they want to play. After this, the game will loop for that many number of times. Each loop, it will ask the player what item they want to use – Rock, Paper, or Scissors. The computer will randomly generate its own item, and a winner will be determined. The game will then save the result as an element of an array, and the next round will begin. Once all the rounds have been played, the program will say "Game Over" and display a list of who…arrow_forward
- ne: ID: A 7. A game is played by moving a game piece left or right along a horizontal game board. The board consists of spaces of various colors, as shown. The circle represents the initial location of the game piece. Yellow Black Green Green Red Yellow Yellow Black Black Black The following algorithm indicates how the game is played. The game continues until the game is either won by landing on the red space or lost when the piece moves off either end of the board. Step 1: Place a game piece on a space that is not red and set a counter to 0. Step 2: If the game piece is on a yellow space, move the game piece 3 positions to the left and go to step 3. Otherwise, if the game piece is on a black space, move the game piece 1 position to the left and go to step 3. Otherwise, if the game piece is on a green space, move the game piece 2 positions to the right and go to step 3. Step 3: Increase the value of the counter by 1. Step 4: If game piece is on the red space or moved off the end of the…arrow_forwardPrompt the user to input five pairs of numbers: A player's jersey number (0 - 99) and the player's rating (1 - 9). Store the jersey numbers in one int array and the ratings in another int array. Output these arrays (i.e., output the roster). Ex: Enter player 1's jersey number: 84 Enter player 1's rating: 7 Enter player 2's jersey number: 23 Enter player 2's rating: 4 Enter player 3's jersey number: 4 Enter player 3's rating: 5 Enter player 4's jersey number: 30 Enter player 4's rating: 2 Enter player 5's jersey number: 66 Enter player 5's rating: 9 ROSTER Player 1 -- Jersey number: 84, Rating: 7 Player 2 -- Jersey number: 23, Rating: 4 ...arrow_forwardimagearrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENTEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageProgramming with Microsoft Visual Basic 2017Computer ScienceISBN:9781337102124Author:Diane ZakPublisher:Cengage Learning
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning