For each of the following sets of integers, write a single statement that will print a number at random from the set.

a) 2, 4, 6, 8, 10.
b) 3, 5, 7, 9, 11.
c) 6, 10, 14, 18, 22.


a)
```
System.out.print( ( int ) ( ( 1 + Math.random() * 5 ) * 2 ) );
```

b)
```
System.out.print( ( int ) ( ( 1 + Math.random() * 5 ) * 2 + 1 ) );
```

c)
```
System.out.print( ( int ) ( ( Math.random() * 5 ) * 4 + 6 ) );
```

Computer Science & Information Technology

You might also like to view...

What is the major difference between a linked file and an attachment?

What will be an ideal response?

Computer Science & Information Technology

The item marked ____ in the accompanying figure is the Show/Hide column.

A. 1 B. 2 C. 5 D. 8

Computer Science & Information Technology

Binding constraints always show a slack of _______.

A. -0.01 B. 0 C. 0.01 D. 1

Computer Science & Information Technology

The five Gradient style buttons are located on the ____________________ bar.

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

Computer Science & Information Technology