I created a player class and I am trying to use my player class with my menu driven player program but when I call my ProcessMenuItem I keep getting the error the name 'number' does not exist in current context. Any help would be appreciated.
const Int32 MAXPLAYERS = 23;
Player[] players = new Player[MAXPLAYERS];
Int32 playerCount = 0;
char menuItem;
Console.WriteLine("Welcome to the player system...\n");
menuItem = GetMenuItem();
while (menuItem != 'X')
{
ProcessMenuItem(menuItem, number, lastName, goals, assists, players, ref playerCount, MAXPLAYERS);
menuItem = GetMenuItem();
}
Console.WriteLine("\nThank you, goodbye");
Console.ReadLine();
}
static char GetMenuItem()
{
char menuItem;
DisplayMenu();
menuItem = char.ToUpper(char.Parse(Console.ReadLine()));
while (menuItem != 'C'
&& menuItem != 'L' && menuItem != 'X' && menuItem != 'R' && menuItem != 'U' && menuItem != 'D')
{
Console.WriteLine("\nError - Invalid menu item");
DisplayMenu();
menuItem = char.ToUpper(char.Parse(Console.ReadLine()));
}
return menuItem;
}
static void DisplayMenu()
{
Console.WriteLine("\nPlease pick an item:");
Console.WriteLine("C - Create Player");
Console.WriteLine("R - Retrive Player");
Console.WriteLine("U - Update Player");
Console.WriteLine("D - Delete Player");
Console.WriteLine("L - List Players");
Console.WriteLine("X - Exit");
}
static void ProcessMenuItem(Char menuItem, Int32 number, String firstName, String lastName, Int32 goals,
Int32 assists, Player[] players, ref Int32 playerCount, Int32 MAXPLAYERS, Int32 RemoveAt)
{
switch (menuItem)
{
case 'C':
ProcessCreate(number, firstName, lastName, goals, assists, players, ref playerCount, MAXPLAYERS);
break;
case 'L':
ProcessList(number, firstName, lastName, goals, assists, players, ref playerCount);
break;
case 'R':
ProcessRetrive( number, lastName, firstName, goals, assists, players, ref playerCount, MAXPLAYERS);
break;
case 'U':
ProcessUpdate(number, firstName,lastName,goals ,assists, players, ref playerCount, MAXPLAYERS);
break;
case 'D':
DeletePlayer(number, firstName,lastName,goals ,assists, players,ref playerCount, MAXPLAYERS, RemoveAt);
break;
}
}