I wanted to consolidate solutions to disparate problems into a single program. I am worried that there is a interface, command pattern, or dictionary solution to what will become a massive switch statement here. However, the main in this program is essentially a meta-program which would switch between the miniature programs that it links to.
static void Main(string[] args)
{
int eulerNumber;
Console.WriteLine("Please enter the number of the Problem you want to solve.");
while (!int.TryParse(Console.ReadLine(), out eulerNumber))
{
Console.WriteLine("Please enter a valid number.");
Console.WriteLine();
Console.WriteLine("Please enter the number of the Problem you want to solve.");
}
switch (eulerNumber)
{
case 1:
//solve problem 1.
break;
case 2:
//solve problem 2.
break;
case 3:
//solve problem 3.
break;
etc. etc. etc.
}
}
This is not an elegant solution, but it seems to mirror the situation quite well, as I see it.
Should I scratch this approach? It seems to me to violate OCP but at the same time, it isn't chaotic, and isn't that much to keep track of, - just tack one more case onto the end, create a new class, and another problem is functional. Should I look into some other structure to make it easier to modify?