using System.Xml.Linq; internal class Program { static bool DataValidationLengthCheck(int intValue) // Validation For Age { if (intValue <= 100) // Put age 100 as the limit for this program return true; //If age below 100 you have picked the correct age limit else return false; // If age over 100 the program say incorrect meaning you are over the age limit } private static void Main(string[] args) { // Data Validation For Surname string Surname = ""; while (true) { Console.WriteLine("Hi there what is your surname?"); //Prompt to user asking their Surname Surname = Console.ReadLine();//Input for user to enter the surname // Data Validation if (Surname == "") { Console.WriteLine("Validation Error!"); Console.WriteLine("Presence Check Fail!"); } else if (Surname.Length < 2) { Console.WriteLine("Length Check Fail"); Console.WriteLine("Please Input Correctly!"); } else { break; } } Console.WriteLine("Hi there Mr " + Surname); //Output the line for the user with surname included int age = 0; while (true) { Console.WriteLine("Please enter your age"); while (true) { try { age = Convert.ToInt16(Console.ReadLine()); break; } catch { Console.WriteLine("Error"); } } if (DataValidationLengthCheck(age)) { Console.WriteLine("Correct"); break; } else { Console.WriteLine("Enter Your Age Correctly"); } } Console.WriteLine("Can you tell please enter your National Insurance Number"); string National = ""; while (true) { Console.WriteLine("Can you input your first two given letters?"); National = Console.ReadLine(); //Data Validation if (National == "") { Console.WriteLine("Validation Error!"); Console.WriteLine("Presence Check Fail!"); } else if (National.Length < 2) { Console.WriteLine("Length Check Fail"); Console.WriteLine("Please Input Correctly!"); } else { break; } } string NationalNumb = ""; while (true) { Console.WriteLine("Can you input you next 6 digit characters from your National Insurance Number ?"); NationalNumb = Console.ReadLine(); //Data Validation if(NationalNumb =="") { Console.WriteLine("Validation Error!"); Console.WriteLine("Presence Check Fail!"); } else if (NationalNumb.Length < 6) { Console.WriteLine("Length Check Fail"); Console.WriteLine("Please Input Correctly!"); } else { break; } } Console.WriteLine("Now enter the last and final character on your National Insurance Number "); string NationalChar = Console.ReadLine(); Console.WriteLine("Your National Insurance Number is " + National + NationalNumb + NationalChar); Console.ReadKey(); } }