The error is: Use of unassigned Local Variable 'stormClass'.
This error happens near the end of the code where it says:
Console.WriteLine("This is {0} hurricane.", stormClass);
stormClass is underlined in red in Visual Studio, so that's what's causing the problem, I just don't know how to fix it...
Here's my code:
using System;
namespace Stormy
{
// Determines whether a tropical storm is a hurricane based on its
// sustained wind speed. If the storm is a hurricane, it should display
// the category of the hurricane. Now that you do not need to display
// the effects of the storm.
//
// Inputs:
// Wind speed in miles per hour (mph)
//
// Outputs:
// Storm Classifications (Not hurricane, category 1 hurricane, category 2 hurricane,
// category 3 hurricane, category 4 hurricane, category 5 hurricane)
class Program
{
static void Main(string[] args)
{
double windSpeed;
string stormClass;
Console.WriteLine("Please enter the windspeed of the storm:");
windSpeed = double.Parse(Console.ReadLine());
// Determines what class the storm is.
if (windSpeed < 74)
stormClass = "not a";
else if (windSpeed < 96)
stormClass = "a Category 1";
else if (windSpeed < 111)
stormClass = "a Category 2";
else if (windSpeed < 131)
stormClass = "a Category 3";
else if (windSpeed < 155)
stormClass = "a Category 4";
else if (windSpeed > 155)
stormClass = "a Category 5";
Console.WriteLine("This is {0} hurricane.", stormClass);
Console.ReadLine();