sync
This commit is contained in:
62
C/CS/Starter_assignment/Program.cs
Normal file
62
C/CS/Starter_assignment/Program.cs
Normal file
@@ -0,0 +1,62 @@
|
||||
namespace Starter_assignment;
|
||||
|
||||
class Program {
|
||||
static void Main() {
|
||||
Course course = new Course();
|
||||
bool running = true;
|
||||
|
||||
while (running) {
|
||||
Console.WriteLine("\n1. Add Student" +
|
||||
"\n2. View All Students" +
|
||||
"\n3. View All Groups" +
|
||||
"\n4. Search Student by Number" +
|
||||
"\n5. Show Students in a Group" +
|
||||
"\n6. Show Statistics" +
|
||||
"\n7. Exit" +
|
||||
"\nChoose an option: ");
|
||||
|
||||
string choice = Console.ReadLine();
|
||||
|
||||
switch (choice)
|
||||
{
|
||||
case "1":
|
||||
Console.Write("Enter student name: ");
|
||||
string name = Console.ReadLine();
|
||||
Console.Write("Enter student number: ");
|
||||
if (int.TryParse(Console.ReadLine(), out int studentNumber)) {
|
||||
course.AddStudent(name, studentNumber);
|
||||
} else {
|
||||
Console.WriteLine("Invalid student number.");
|
||||
}
|
||||
break;
|
||||
case "2":
|
||||
course.ViewAllStudents();
|
||||
break;
|
||||
case "3":
|
||||
course.ViewAllGroups();
|
||||
break;
|
||||
case "4":
|
||||
Console.Write("Enter student number: ");
|
||||
if (int.TryParse(Console.ReadLine(), out int searchNumber)) {
|
||||
course.SearchByStudentNumber(searchNumber);
|
||||
}
|
||||
break;
|
||||
case "5":
|
||||
Console.Write("Enter group name: ");
|
||||
string groupName = Console.ReadLine();
|
||||
course.SearchByGroup(groupName);
|
||||
break;
|
||||
case "6":
|
||||
course.ShowStatistics();
|
||||
break;
|
||||
case "7":
|
||||
running = false;
|
||||
break;
|
||||
default:
|
||||
Console.WriteLine("Invalid option, try again.");
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user