I am having various problems with course as when I put the code in they say that the keyword can’t be followed and I cannot convert void into int.
This is where the code’s error occurs:
static void TranslateToNumber(string creature)
{
switch (creature)
{
case “ghost”:
return 1;
case "bug":
return 2;
case "monster":
return 3;
default:
return 1;
}
int headNum = "body";
int bodyNum = "feet";
int feetNum = "head";
}
And this is the entire code:
using System;
namespace ExquisiteCorpse
{
class Program
{
static void Main(string args)
{
RandomMode();
}
static void BuildACreature(string head, string body, string feet)
{
}
static void RandomMode()
{
Random randomNumber = new Random();
int head = randomNumber.Next(1, 4);
int body = randomNumber.Next(1, 4);
int feet = randomNumber.Next(1, 4);
SwitchCase(head, body, feet);
}
static void SwitchCase(int head, int body, int feet)
{
}
static void TranslateToNumber(string creature)
{
switch (creature)
{
case "ghost":
return 1;
case "bug":
return 2;
case "monster":
return 3;
default:
return 1;
}
int headNum = "body";
int bodyNum = "feet";
int feetNum = "head";
}
public static void GhostHead()
{
Console.WriteLine(" ..-..");
Console.WriteLine(" ( o o )");
Console.WriteLine(" | O |");
}
public static void GhostBody()
{
Console.WriteLine(" | |");
Console.WriteLine(" | |");
Console.WriteLine(" | |");
}
public static void GhostFeet()
{
Console.WriteLine(" | |");
Console.WriteLine(" | |");
Console.WriteLine(" '~~~~~'");
}
public static void BugHead()
{
Console.WriteLine(" / \\");
Console.WriteLine(" \\. ./");
Console.WriteLine(" (o + o)");
}
public static void BugBody()
{
Console.WriteLine(" --| | |--");
Console.WriteLine(" --| | |--");
Console.WriteLine(" --| | |--");
}
public static void BugFeet()
{
Console.WriteLine(" v v");
Console.WriteLine(" *****");
}
public static void MonsterHead()
{
Console.WriteLine(" _____");
Console.WriteLine(" .-,;='';_),-.");
Console.WriteLine(" \\_\\(),()/_/");
Console.WriteLine(" (,___,)");
}
public static void MonsterBody()
{
Console.WriteLine(" ,-/`~`\\-,___");
Console.WriteLine(" / /).:.('--._)");
Console.WriteLine(" {_[ (_,_)");
}
public static void MonsterFeet()
{
Console.WriteLine(" | Y |");
Console.WriteLine(" / | \\");
Console.WriteLine(" \"\"\"\" \"\"\"\"");
}
}
}