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...
Add a method to the Turtle class to draw a simple house. It can have a rectangle for the house and an equilateral triangle as the roof.
Note: New method at bottom
Recursion often is preferable to iteration because ________.
a. it is faster. b. it requires less memory. c. it models the problem more logically. d. All of the above.
Audio files with a .wma extension can be embedded in PowerPoint
Indicate whether the statement is true or false
____________________ is another name given to third normal form in this text.
Fill in the blank(s) with the appropriate word(s).