Assume that txtAge is a TextBox control and that the user has entered the value 27 into this TextBox. Determine the action performed by the following code:

What will be an ideal response?

This code prints text when an age is inputted into the txtAge TextBox. In this case,
the statement txtAge.Text = "Young adult"; executes, because the value of intAge is less than 30, but not less than 20. The complete code reads:

```
int intAge;
intAge = Int32.Parse( txtAge.Text );
if ( intAge < 0 )
{
txtAge.Text = "Enter a value greater than or equal to zero.”;
}
else if ( intAge < 13 )
{
txtAge.Text = "Child";
}
else if ( intAge < 20 )
{
txtAge.Text = "Teenager";
}
else if ( intAge < 30 )
{
txtAge.Text = "Young adult";
}
else if ( intAge < 65 )
{
txtAge.Text = "Adult";
}
else
{
txtAge.Text = "Senior Citizen";
}
```

Computer Science & Information Technology

You might also like to view...

A foundation to tomorrow's learning, ________, uses Web 2.0 computing and communication technologies to support learning.

A) Media literacy B) Cyberlearning C) Coding D) Learning centers

Computer Science & Information Technology

Files contain certain properties that allow you to locate and organize them in a PC

Indicate whether the statement is true or false

Computer Science & Information Technology