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

Create a IPO Chart, Pseudo and Flowchart for the following code using System; us

ID: 3592199 • Letter: C

Question

Create a IPO Chart, Pseudo and Flowchart for the following code


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace wk5collabproject
{
class Program
{
static void Main(string[] args)
{
string word = "GUESSED";
char[] array = new char[word.Length];
for (int i = 0; i < word.Length; i++)
array[i] = '*';
Console.WriteLine("Welcome to the hangman game! ");
int score = 0;
for (int j = 0; j < 10; j++)
{
Console.WriteLine(array);
Console.WriteLine("Enter a letter please");
//char ch = (char) Console.Read();
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)
{
Console.WriteLine("You guessed incorrectly!");
}
else
{
// Score is used keep track of how many letters are in the guessed array
score++;
Console.WriteLine("You guessed a letter correctly!");
}
if (word.Equals(new string(array)))
{
Console.WriteLine(array);
Console.WriteLine("Congratulations! You have figured out the word! ");
Console.ReadLine();//To keep console window open, your last line of code
}
}
}
}
}

Explanation / Answer


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace wk5collabproject
{
class Program
{
static void Main(string[] args)
{
string word = "GUESSED";
char[] array = new char[word.Length];
for (int i = 0; i < word.Length; i++)
array[i] = '*';
Console.WriteLine("Welcome to the hangman game! ");
int score = 0;
for (int j = 0; j < 10; j++)
{
Console.WriteLine(array);
Console.WriteLine("Enter a letter please");
//char ch = (char) Console.Read();
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)
{
Console.WriteLine("You guessed incorrectly!");
}
else
{
// Score is used keep track of how many letters are in the guessed array
score++;
Console.WriteLine("You guessed a letter correctly!");
}
if (word.Equals(new string(array)))
{
Console.WriteLine(array);
Console.WriteLine("Congratulations! You have figured out the word! ");
Console.ReadLine();//To keep console window open, your last line of code
}
}
}
}
}