Write a method called alarm that prints the string "Alarm!" multiple times on separate lines. The method should accept an integer parameter that specifies how many times the string is printed. Print an error message if the parameter is less than 1.
What will be an ideal response?
```
public void alarm(int number)
{
if (number < 1)
System.out.println("ERROR: Number is less than 1.");
else
for (int count = 1; count <= number; count++)
System.out.println("Alarm!");
}
```
You might also like to view...
Input boxes with the number data type are displayed using a spinner control in which users click an up or down arrow to increase or decrease the field value, respectively.
Answer the following statement true (T) or false (F)
In OpenOffice, all available clip art can be found in the ________
A) Gallery B) clip art repository C) vendor folder D) illustration pane
In __________, the network designer examines the available technologies and assesses which options will meet the users' needs.
a. technology design b. needs analysis c. narrow and deep analysis d. cost assessment e. distribution layering
Because database operations block the UI thread of your application, you should always run database operations in which of the following?
a. Foreground thread b. UI thread c. Background thread d. SyncTask