public void PopulateMembers() { string[] firstNames = new String[] { "Maisie" }; string[] lastNames = new String[] { "Vuong" }; string[] addresses = new String[] { "Rockhampton" }; string[] contactNumbers = new String[] { "0405866572" }; string[] passwords = new String[] { "1234" }; for (int i = 0; i < firstNames.Length; i++) { Member member = new Member(firstNames[i], lastNames[i], addresses[i], contactNumbers[i], passwords[i]); Members.AddNewMember(member); } }
/// <summary> /// Read input to add a new member to MemberCollections. /// </summary> public void TryRegisteringMember() { Console.Write("\nWhat is this person's first name? "); string firstName = Console.ReadLine(); Console.Write("What is this person's last name? "); string lastName = Console.ReadLine(); Console.Write("Where does this person live? "); string address = Console.ReadLine(); bool isValidInput = false; string contactNumber = ""; while (!isValidInput) { Console.Write("What is this person's contact number? "); contactNumber = Console.ReadLine(); isValidInput = int.TryParse(contactNumber, out int mobileInteger); } isValidInput = false; string password = ""; while (!isValidInput) { Console.Write("What is this person's password? "); // Movie name password = Console.ReadLine(); isValidInput = int.TryParse(password, out int passwordInteger) && password.Length == 4; } Member member = new Member(firstName, lastName, address, contactNumber, password); bool isAdded = Members.AddNewMember(member); if (isAdded) { Console.WriteLine("{0} successfully added to the system.", member.GetUserName()); } else { Console.WriteLine("{0} could not be added to the system. Are the number of members exceeding 10?", member.GetUserName()); } }