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

I was hoping to get some input on if this C# code is correct or if I need to fix

ID: 671585 • Letter: I

Question

I was hoping to get some input on if this C# code is correct or if I need to fix somethings, any information would be greatly apreciated

class Program
{
static void Main(string[] args)

{
char guessedletter1 = 's';
Char guessedletter2 = 't';
Char guessedletter3 = 'i';
char guessedletter4 = 'n';
char guessedletter5 = 's';
Char guessedletter6 = 'o';
Char guessedletter7 = 'n';
Char Input;

WelcomeMessage();
Input = GetInput();
Input = GetInput();
Input = GetInput();
Input = GetInput();
Input = GetInput();
Input = GetInput();
Input = GetInput();

Console.WriteLine("");

Console.Write("Press any key to continue...");
Console.ReadKey();
}

private static char GetInput()
{
Console.Write("Enter a letter please: ");
ConsoleKeyInfo ckInfo = Console.ReadKey();
Console.WriteLine("");
return ckInfo.KeyChar;
}

private static void WelcomeMessage()
{

Console.WriteLine("************************************************************");
Console.WriteLine("*********************** WEEK 4 *****************************");
Console.WriteLine("************************************************************");
Console.WriteLine("");
}
}
}

Explanation / Answer

using System.IO;
using System;

class Program
{
static void Main(string[] args)
{
char guessedletter1 = 's';
char guessedletter2 = 't';
char guessedletter3 = 'i';
char guessedletter4 = 'n';
char guessedletter5 = 's';
char guessedletter6 = 'o';
char guessedletter7 = 'n';
char Input;
WelcomeMessage();
Input = GetInput();
Input = GetInput();
Input = GetInput();
Input = GetInput();
Input = GetInput();
Input = GetInput();
Input = GetInput();
Console.WriteLine("");
Console.Write("Press any key to continue...");
Console.ReadKey();
}
private static char GetInput()
{
Console.Write("Enter a letter please: ");
ConsoleKeyInfo ckInfo = Console.ReadKey();
Console.WriteLine("");
return ckInfo.KeyChar;
}
private static void WelcomeMessage()
{
Console.WriteLine("************************************************************");
Console.WriteLine("*********************** WEEK 4 *****************************");
Console.WriteLine("************************************************************");
Console.WriteLine("");
}
}

I removed one the extra braces and made Char to char

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote