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

All of the other answers I\'ve looked at are full of errors and aren\'t making s

ID: 3890540 • Letter: A

Question

All of the other answers I've looked at are full of errors and aren't making sense. Please help me! (Using C#)

You will create the IPO chart and pseudocode for the program, then you will continue to update the IPO chart and pseudocode each week. The MS Visual Studio project file will also be updated from week to week, so there will be no need to start from scratch each week.

Each week you will submit the following:

Current IPO chart and pseudocode

MS Visual Studio Project folder

Completed Test Plan

Put the IPO chart, pseudocode, and test plan in the MS Visual Studio project folder and zip up the entire folder and submit the zip file to the Dropbox.

Programming Standards

Each increment of the program will adhere to the following standards:

Each source file will have a header describing the program, programmers name, date, purpose of the program, and increment.

Each source file will adhere to the coding standards provided in the lecture, or given by the Professor.

Each program will have an introductory output message introducing the program to the user and providing directions.

Each program will have any necessary program termination statements, preventing the execution window from automatically disappearing.

All program output will be well structured, easy to read, and numerical values appropriately formatted.

Problem Description

You will be creating a Hangman program. In this game, the computer will have a hard coded word and the user will enter one letter at a time until he or she has guesses the correct word. A score will be tallied that will be the number of incorrect guesses the user has. So a smaller score is better.

Initially the word will be displayed as a list of special characters such as '*' or '-'. The user will input one letter at a time and each input will be compared with the word. If the guess is correct the letter will be displayed rather than the special character. Each incorrect guess will increment the score. When the user guesses the correct word the game will be over.

Below is an example of the program running:

file:///C/Users/gina/AppData/Local/Temporary Projects/hangman1/bin/Debug/hangma Welcome to the hangman gane! Enter a letter please: You guessed a letter correctly! Enter a letter please You guessed incorrectly Enter a letter please You guessed a letter correctly! Enter a letter please: You guessed incorrectly Enter a letter please: You guessed a letter correctly! h*ppy Enter a letter please: You guessed a letter correctly! happy Congratulations! You have figured out the uord! Your score is: 2

Explanation / Answer

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication22
{
    class Program
    {
        static void Main(string[] args)
        {
            string word = "happy";
            char[] array = new char[5];
            for (int i = 0; i<5; i++)
                 array[i] = '*';
            Console.WriteLine("Welcome to the hangman game! ");
            Boolean gussed = false;
            int score = 0;
            while (!gussed)
            {
                Console.WriteLine(array);
                Console.WriteLine("Enter a letter please");
                string str = Console.ReadLine();
                int found = 0;
                for (int i = 0; i < word.Length; i++)
                {
                    if (str[0] == word[i])
                    {
                        array[i] = word[i];
                        found = 1;
                    }
                }
                if (found == 0)
                {
                    score++;
                    Console.WriteLine("You gussed incorrectly!");
                }
                else
                {
                    Console.WriteLine("You gussed a letter correctly!");
                }
                if (word.Equals(new string(array)))
                {
                    Console.WriteLine(array);
                    Console.WriteLine("Congratulations! You have figured out the word! your score is " + score);
                    gussed = true;
                }
            }
        }
    }
}