blob: 7976288b1bfe4b403df9f0692be5a4e54daf1ddc (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
package Q4;
import java.io.*;
import java.util.*;
public class RandomSumGame {
private boolean start;
private int d1;
private int d2;
private int sum;
private int valuePoint;
private String status;
private PrintStream out;
public RandomSumGame(PrintStream out) {
this.out = out;
}
public void play(int d1, int d2) {}
public void play() {
this.rollDice();
this.play(this.d1, this.d2);
}
public void rollDice() {
this.d1 = this.roll();
this.d2 = this.roll();
}
private int roll() {
return new Random().nextInt(5) + 1;
}
}
|