using System.Collections.Generic;
static List<Student> Record = new List<Student>();
public static void Main()
Console.WriteLine("1. Enter Student Info\n2. View\n3. Search\n4. Exit");
int ans = int.Parse(Console.ReadLine());
Console.WriteLine("\nView Student Info by: \n1. ID\n2. Last Name\n3. Age");
int i = int.Parse(Console.ReadLine());
Console.WriteLine("Invalid Input");
Console.WriteLine("Exiting program..");
Console.WriteLine("Invalid Input\n");
public static void addStudent(){
Console.WriteLine("Enter Student ID: ");
int id = int.Parse((Console.ReadLine()));
Console.WriteLine("Enter Last Name: ");
string lName = Console.ReadLine();
Console.WriteLine("Enter First Name: ");
string fName = Console.ReadLine();
Console.WriteLine("Enter Age: ");
int age = int.Parse((Console.ReadLine()));
Student stu = new Student(id,lName,fName,age);
Console.WriteLine("\nStudent has been added.");
List<Student> byID = new List<Student>(Record);
byID.Sort((s1,s2) => s1.Id.CompareTo(s2.Id));
var a1 = "Last Name".PadRight(10);
var a2 = "First Name".PadRight(10);
Console.WriteLine("ID\t{0}\t{1}\tAge",a1,a2);
public static void ViewLN(){
List<Student> byLN = new List<Student>(Record);
byLN.Sort((s1,s2) => s1.LastName.CompareTo(s2.LastName));
Console.WriteLine("ID\tLast Name\tFirst Name\tAge");
public static void ViewAge(){
List<Student> byAge = new List<Student>(Record);
byAge.Sort((s1,s2) => s1.LastName.CompareTo(s2.Age));
Console.WriteLine("ID\tLast Name\tFirst Name\tAge");
public static void search(){
Console.WriteLine("Search Records by:\n1. Last Name\n2. ID");
int i = int.Parse(Console.ReadLine());
Console.WriteLine("Enter Last Name: ");
string input = Console.ReadLine();
List<Student> LN = Record.FindAll(s => s.LastName.Equals(input));
Console.WriteLine("Student records found:");
Console.WriteLine("Student records not found.");
Console.WriteLine("Enter Student ID:");
int stuID = int.Parse(Console.ReadLine());
Student stuId = Record.Find(s => s.Id == stuID);
Console.WriteLine("Student record found:");
Console.WriteLine("ID\tLast Name\tFirst Name\tAge");
Console.WriteLine("Student record not found.");
Console.WriteLine("Invalid Input");
static void display(Student stu){
Console.WriteLine("{0}\t{1}\t{2}\t{3}",stu.Id,stu.LastName.PadRight(10),stu.FirstName.PadRight(10),stu.Age);
public int Id { get; set; }
public string LastName { get; set; }
public string FirstName { get; set; }
public int Age { get; set; }
public Student(int id, string lastName, string firstName, int age)