Jean101
Member
- Joined
- Feb 8, 2020
- Messages
- 10
- Programming Experience
- 1-3
How to properly display the name of the student with degree in mobile only in a private Dictionary<string, string> _studentDegree = new Dictionary<string, string>();
I'm having a hard time coming with a way to just show mobile student. Hours staring at the screen with blank ideas.
I'm having a hard time coming with a way to just show mobile student. Hours staring at the screen with blank ideas.
C#:
// This method work perfectly
private void ShowAllStudents()
{
Console.Clear();
//Setting UI color
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("Show All Students: ");
Console.WriteLine("==================");
Console.WriteLine("==================");
Console.ForegroundColor = ConsoleColor.Gray;
Student myStudent = new Student();
int counter = 0;
Console.WriteLine($"{" "} {"Name", -15} {"Degree", -10}");
foreach (KeyValuePair<string, string> kvp in _studentDegree)
{
counter++;
Console.WriteLine($"{counter}. {kvp.Key, -15} {kvp.Value, -10}");
//myStudent.GenerateGrade();
}
Console.WriteLine("Press any key to continue...");
Console.ReadKey();
_myMenu.Display();
Selection();
}
// Output:
Show All Students:
Name Degree
1. JEAN MOBILE
2. MAX WEB
3. LU MOBILE
4. TOM WEB
Press any key to continue...
//End of method
// Only display mobile student
private void ShowMobileStudents()
{
Console.Clear();
//Setting UI color
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("Show Mobile Students: ");
Console.WriteLine("=====================");
Console.WriteLine("=====================");
Console.ForegroundColor = ConsoleColor.Gray;
Console.WriteLine("Press any key to continue...");
Console.ReadKey();
_myMenu.Display();
Selection();
}