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?


```
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...

What will the following section of code do when the user clicks the btnExit button?

Private Sub btnExit_Click(ByVal sender As System.Object, _ ByVal e as System.EventArgs) Handles btnExit.Click Me.Close() End Sub a. Shut down the computer b. Log off the current user c. Close the current form d. All of the above

Computer Science & Information Technology

Create an application that allows the user to enter the lengths for the three sides of a triangle as integers. Your application should then deter- mine whether the triangle is a right triangle (two sides of the triangle form a 90-degree angle), an equilateral triangle (all sides of equal length) or neither. Your application’s GUI is completed for you (Fig. 18.39). You must create a class to represent a triangle object and declare the createJButtonActionPerformed method.


a) Copying the template to your working directory. Copy the C:Examples Tutorial18ExercisesTriangleCreator directory to your C:SimplyJava direc- tory.
b) Opening the template files. Open the TriangleCreator.java and Triangle.java
files in your text editor.
c) Declaring variables. View the Triangle.java file and declare three int variables (side1, side2, side3) starting on line 6 to hold the length of each side. They should all be declared private so that only the methods of this class can access them.
d) Declaring the necessary get and set methods. After the instance variable declarations declare a constructor that will take the lengths of the three sides of a triangle as argu- ments. Your constructor should always set instance variables by using corresponding set methods. Following the constructor, create three pairs of get and set methods that enable clients to access and modify the lengths of the three sides. If the user enters a negative value, that side should be assigned the

Computer Science & Information Technology

A video can be played by pressing ________

A) [F3] B) [Alt]+[P] C) [Ctrl]+[P] D) [Shift]+[P]

Computer Science & Information Technology

A security analyst suspects a malware infection was caused by a user who downloaded malware after clicking http:///a.php in a phishing email. To prevent other computers from being infected by the same malware variation, the analyst should create a rule on the:

A. email server that automatically deletes attached executables. B. IDS to match the malware sample. C. proxy to block all connections to D. firewall to block connection attempts to dynamic DNS hosts.

Computer Science & Information Technology