public static void AddStudent(List <Student> studentList) { string answer = Validation.GetResponse("\nSelect 1) to add a Current Student or 2) for an Archived Student: "); while (true) { if (answer == "1") { Student student = new Student(); student = EditList.AddStudent(student); studentList.Add(student); break; } else if (answer == "2") { ArchivedStudent archivedStudent = new ArchivedStudent(); Student student = new ArchivedStudent(); student = EditList.AddStudent(archivedStudent); studentList.Add(student); break; } else { answer = Validation.GetResponse("Sorry, that's not valid. Please enter 1 or 2. "); continue; } } }
public static Student AddStudent(ArchivedStudent archivedStudent) { string firstName = Validation.GetString("Enter first name: "); string lastName = Validation.GetString("Enter last name: "); string address = Validation.GetResponse("Enter address: "); string program = Validation.GetString("Enter program: "); int year = Validation.GetInt("Enter year: "); double fee = Validation.GetDouble("Enter fee: "); int finalScore = Validation.GetScore("Enter final score: "); Student student = new ArchivedStudent(firstName, lastName, address, program, year, fee, finalScore); return(student); }
static void Main(string[] args) { Student student1 = new Student("Ron", "Weasley", "456 Somewhere in England", "Magical studies", 4, 30000.00); Student student3 = new Student("Ginny", "Weasley", "456 Somewhere in Englad", "Magical studies", 1, 300.00); Student student5 = new Student("Elsa", "Icy", "Ice Mountain", "Freezing People", 12, 4500.00); Student student2 = new ArchivedStudent("Leeroy", "Jenkins", "123 Nowhere IronForge", "Paladin studies", 4, 30000.00, 5); Student student4 = new ArchivedStudent("Sandy", "Cheeks", "1 Glass Dome Bikini Bottom", "Kickin butt", 1, 50000.00, 90); Student student6 = new ArchivedStudent(); List <Student> studentList = new List <Student> { student1, student2, student3, student4, student5, student6 }; Console.WriteLine("Welcome to the Student Database!"); MainMenu(studentList); }