Home / Expert Answers / Computer Science / ask-the-user-to-enter-their-age-if-the-age-is-between-1-and-100-print-a-message-stating-the-age-the-pa329

(Solved): Ask the user to enter their age If the age is between 1 and 100 print a message stating the age the ...



Ask the user to enter their age If the age is between 1 and 100 print a message stating the age the user entered exit the program If the age is less than 1 or greater than 100 generate an ArgumentOutOfRangeException print the exception information print an error message If the value is not an integer handle the FormatException print the exception information print an error message Continue asking the user to enter their age until a valid age is entered. 

 

i need the C# code that follows these rules and put out this output 

 

 

 

Your Name - Week 4 PA User Entry of Age
Please enter your age: twenty
System. FormatException: Input string was not in a corr

Your Name - Week 4 PA User Entry of Age Please enter your age: twenty System. FormatException: Input string was not in a correct format. at System.Number. ThrowOverflowOrFormatException(ParsingStatus status, TypeCode type) at System.Convert.ToInt32(String value) Please enter an integer in range 1 - 100. Please enter your age: 0 System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Please enter an integer in range 1 - 100. Please enter your age: \( -5 \) System. ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Please enter an integer in range 1 - 100. Please enter your age: 101 System. ArgumentOutOfRangeException: Specified argument was out of the range of valid values. Please enter an integer in range 1 - 100. Please enter your age: 25 The age entered is: 25


We have an Answer from Expert

View Expert Answer

Expert Answer


code to check for FormatException and ArgumentOutOfRangeException try{ int age = Conver
We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe