CSC1020 Homework 4

Overview

We are going to take our calculator that we created in Homework 3 and reimplement it using FXML, adding a few features to it in the process.

calculator

All of the functionality from Homework 3 should continue to work unless otherwise noted below.

Details

Initializing the Controller

The CalculatorController should implement the JavaFX Initializable interface. JavaFX calls the initialize method after the FXML file has been loaded and the FXML controls have been connected to the Controller. You do not need to understand the parameters passed to the method for this assignment.

Use initialize in the same way that you would normally use a constructor for the Controller. Any Controller instance variables that are not created through FXML should be initialized in this method.

For example:

public class CalculatorController implements Initializable {
    @Override
    public void initialize(URL url, ResourceBundle resourceBundle) {
        // Initialize non-FXML instance variables here
    }
}

Calculator Class

The Calculator class should be responsible for performing the arithmetic operations. The Controller should use the Calculator rather than performing the calculations itself.

The Calculator class must contain and use a private functional interface to perform the arithmetic operations. How you design that interface and how you use it within the Calculator is up to you.

Additional Functionality

In addition to the functionality from Homework 3, we will add the following functionality:

example