In: Computer Science
In a JavaFX application there is a TextField control(tfRadius) for taking input of a circle's radius. A respective square whose diagonal is the circle's diameter can then be created. There are three other controls in this application: a button(btCalculate), two textareas(trCircleArea, trSquareArea). When the button is clicked, the circle's area is calculated and displayed on trCircleArea, furthermore, the square's area is also calculated and displayed on trSquareArea.
Please write portions of codes which calculates the circle's area and the square's area when the button(btCalculate) is clicked which calculates the circle's area and the squares when the button(btCalculate) is clicked and both of the calculated areas are displayed on their respective textarea controls(trCircleArea, trSquareArea). Assuming the codes for layout setup are completed and you are only required to complete the calculation part and handling of button click event