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!");
}
```

Computer Science & Information Technology

You might also like to view...

When you recolor a picture, all colors in the picture change to only one shade

Indicate whether the statement is true or false

Computer Science & Information Technology

What is a weighted graph?

What will be an ideal response?

Computer Science & Information Technology