Collegeboard FRQ Practice
FRQ Practice
class GameSpinner {
private int sectors;
private int runLength;
private int lastSpin;
public GameSpinner(int sectors) {
this.sectors = sectors;
this.runLength = 0;
}
public int spin() {
int spin = (int) (Math.random() * 4);
// increment runlength if same value as last time
if (this.lastSpin == spin) {
runLength++;
}
else {
runlength = 1;
}
// set last spin to new value
this.lastSpin = spin;
return spin;
}
public int currentRun() {
return runLength;
}
}
public void addReview(ProductReview prodReview) {
}