Just curious as to what might be the most efficient way to accomplish this. I am new to using C# and im trying to redo some of my old school projects. I have a student object (student ID, first name, last name, gpa, credit hours, and 2 enums: academic standing and classification(freshman, sophomore etc)). In my main i built a switch and id like to allow for the option to make changes to or delete a record. My program is set up so that everything is indexed by student ID, when the program is first ran it displays the ID of every student (currently 5) and to view a record you enter an ID from the list.
Code
bool done = false;
while (!done)
{
Console.WriteLine("\nPlease choose one of the following options: ");
Console.WriteLine("1: View a student Record");
Console.WriteLine("2: Update a record");
Console.WriteLine("3: Delete a record");
Console.WriteLine("4: Terminate");
Console.WriteLine("5: Bonus Round!");
string choice = Console.ReadLine();
switch (choice)
{
case "1":
Console.Write("Enter Student ID: ");
stuCodeID = long.Parse(Console.ReadLine());
Console.WriteLine("====================================");
Console.WriteLine("Student Record");
Console.WriteLine("------------------------------------");
Console.WriteLine(listStudents[stuCodeID]);
Console.WriteLine("====================================");
break;
case "2":
Console.WriteLine("\nUnavailable at this time.");
break;
case "3":
Console.WriteLine("\nUnavailable at this time.");
break;
case "4":
Console.WriteLine("\nTerminating");
done = true;
break;
case "5":
System.Diagnostics.Process.Start("http://xkcd.com/292/");
break;
}
}
Code
public Student()
{
Random rnd = new Random();
stuID = rnd.Next(100000, 999999);
stuFirstName = "";
stuLastName = "";
stuGPA = 0.00M;
stuCreditHours = 0;
stuStanding = AcademicStanding.Unknown;
stuClassification = StudentClassification.Unknown;
}