Write a segment of code that will use a dialog box to ask a user to enter their age. Their age will then be stored in an int variable named userAge. Assume that the necessary import statements to support the dialog box are already in place.

What will be an ideal response?


```
int userAge;
String ageStr; // used for user's response
ageStr = JOptionPane.showInputDialog("How old are you"?);
userAge = Integer.parseInt(ageStr);
```

Computer Science & Information Technology

You might also like to view...

What is the purpose of exception handling?

What will be an ideal response?

Computer Science & Information Technology

Billy invites four friends over for a birthday party. His cake is made in the shape of a 10-inch by 10-inch square, one inch high, with frosting on the top and sides. How can the cake be cut with just five slices of the knife so that each of the five persons get a piece with same amount of cake and the same amount of frosting?

Solve the following time-rate-distance problems using the IPO method. Ignore time zones.

Computer Science & Information Technology

_____ computing refers to deployments in which service providers offer their cloud-based services to the general public.

Fill in the blank(s) with the appropriate word(s).

Computer Science & Information Technology

Sara, a user, downloads a keygen to install pirated software. After running the keygen, system performance is extremely slow and numerous antivirus alerts are displayed. Which of the following BEST describes this type of malware?

A. Logic bomb B. Worm C. Trojan D. Adware

Computer Science & Information Technology