Rewrite the for loop body from the SnakeEyes program so that the variables num1 and num2 are not used.

What will be an ideal response?

```
for (int roll=1; roll <= ROLLS; roll++)
if (die1.roll() == 1 and die2.roll() == 1)
count++;

```

Computer Science & Information Technology

You might also like to view...

Answer the following statements true (T) or false (F)

1. The following are equivalent While and Until statements. While (num > 2) And (num < 5) Until (num <= 2) Or (num >= 5) 2. A Do…Loop Until block is always executed at least once. 3. A counter variable is normally incremented or decremented by 1. 4. The following program uses a counter variable to force the loop to end. ``` Private Sub btnDisplay_Click(...) Handles btnDisplay.Click Dim r As Double = 1 Dim t As Double = 0 Do While (t < 5000) t = 2 * t + r r += 1 lstBox.Items.Add(t) Loop End Sub ``` 5. The value of the counter variable should not be altered within the body of a For…Next loop.

Computer Science & Information Technology

What will be the result of the following statements?

``` FileInputStream fstream = new FileInputStream("Input.dat"); DataInputStream inFile = new DataInputStream(fstream); ``` a. The inFile variable will reference an object that is able to read random access data from the Input.dat file. b. The inFile variable will reference an object that is able to read text data from the Input.dat file. c. The inFile variable will reference an object that is able to read binary data from the Input.dat file. d. The inFile variable will reference an object that is able to write binary data to the Input.dat file.

Computer Science & Information Technology