Question 6. [18 marks]
Model/View/Controller Re-write DiceNonMVC using the Model/View/Controller pattern. Do this by complet-
ing/modifying the classes below. Don’t worry about the imports.
Part (a) [3 marks]
Modify DiceModel as appropriate. 

public class DiceModel extends Observable {
    private Random randomSource=new Random();
    private int diceValue1;
    private int diceValue2;
    public DiceModel(){
        this.roll();
    }
    public void roll(){
        this.diceValue1=randomSource.nextInt(6)+1; // 0..5->1..6
        this.diceValue2=randomSource.nextInt(6)+1; // 0..5->1..6
    }
    public int getDiceValue1(){
        return this.diceValue1;
    }
    public int getDiceValue2(){
        return this.diceValue2;
    }
}

CSC 207H5 F Midterm Examination OCTOBER 2016
Part (b) [5 marks]
Write class DiceController below. NOTE: See DiceView below!




Part (c) [10 marks]
Modify and complete class DiceView below.


public class DiceView extends Application {

    public static void main(String[] args) {
        launch(args);
    }

    @Override
    public void start(Stage stage) throws Exception {

	// MODEL
        DiceModel model = 

	// CONTROLLER
        DiceController controller = 

        // VIEW


        // STAGE
        stage.setTitle("Dice");
        stage.setScene(scene);
        stage.show();
    }

}

