Hello! I am having trouble figuring out what is wrong with my code here. one of the errors that I am receiving is telling me it is expecting a ; at the end of my switch. Any hints as where to look would be appreciated.
using System;
namespace ChooseYourOwnAdventure
{
class Program
{
static void Main(string args)
{
/* THE MYSTERIOUS NOISE */
// Start by asking for the user's name:
Console.Write("What is your name?: ");
string name = Console.ReadLine();
Console.WriteLine($"Hello, {name}! Welcome to our story.");
Console.WriteLine("It begins on a cold rainy night. YOu're sitting in your room and hear a noise coming from down the hall. Do you investigate?");
Console.WriteLine("Type YES or NO:");
string noiseChoice = Console.ReadLine();
//makes user input UPPERCASE
string upperNoiseChoice = noiseChoice.ToUpper();
if (upperNoiseChoice == "NO")
{
Console.WriteLine("Not much of an adventure if we don't leave our room!");
Console.WriteLine("THE END.");
}
else if (upperNoiseChoice == "YES")
{
Console.WriteLine("You walk into the hallway and see a light coming from under a door down the hall.");
Console.WriteLine("You walk towards it. Do you open it or knock?");
Console.WriteLine("Type OPEN or KNOCK:");
string doorChoice = Console.ReadLine().ToUpper;
if (doorChoice == "KNOCK")
{
Console.WriteLine("A voice behind the door speaks. It says, \"Answer this riddle:\"");
Console.WriteLine("\"Poor people have it. Rich people need it. If you eat it you die. What is it?\"");
Console.WriteLine("Type your answer: ");
string riddleAnswer = Console.ReadLine().ToUpper;
if (riddleAnswer == "NOTHING")
{
Console.WriteLine("The door opens and NOTHING is there.");
Console.WriteLine("You turn off the light and run back to your room and lock the door.");
Console.WriteLine("THE END.");
}
else if (doorChoice == "OPEN")
{
Console.WriteLine("You answered incorrectly and the door doesn't open.");
Console.WriteLine("THE END.");
}
}
else if (doorChoice == "OPEN")
{
Console.WriteLine("The door is locked! See if one of you three keys will open it.");
Console.Write("Enter a number (1-3):");
string keyChoice = Console.ReadLine().ToUpper();
//string upperKeyChoice = keyChoice.ToUpper();
Switch (keyChoice)
{
case "1":
Console.WriteLine("You choose the first key. Lucky Choice!");
Console.WriteLine("The door opens and NOTHING is there. Strange...");
Console.WriteLine("THE END");
break;
case "2":
Console.WriteLine("You choose the second key. THe door doesn't open.");
Console.WriteLine("THE END.");
break;
case "3":
Console.WriteLine("You choose the second key. THe door doesn't open.");
Console.WriteLine("THE END.");
break;
default:
Console.WriteLine("Incorrect input the story ends here...");
break;
}
}
}
}
}
}