CSC 502 Graded Homework 2

Write a JavaFX application that implements a program for ordering a pizza. The user interface should look as seen in the following graphic.

The user interface has a panel at the top for selecting a crust. This panel uses radiobuttons. There is another panel for selecting toppings that uses checkboxes. Both ofthese panels have a un-editable texfield that shows the total cost of the selections in that panel. These text fields will be immediately updated with each change in the selections.

The bottom of the user interface has places for the subtotal, tax (tax is 10 %) and total cost. These three fields are updated when the Calculate Total Cost button at the bottom is clicked.

You should proceed by carefully examinining the user interface to see where you can reuse code. For example, note how a label and an uneditable text field appear together 5 times: for the Price of the selected crust, the Price fo the selected toppings, the Subtotal, the Tax, and Total Cost. Each time they appear, they are inside of a horizontal box with center-right alignment. To avoid code duplication, you can create a subclass of a horizontal box that takes a string and a text field as constructor parameters and sets up the horizontal box:

class PriceDisplayPane extends HBox
    public PriceDisplayPane(String text, TextField displayTextField)
       this.getChildren().addAll(new Label(text), displayTextField);
       this.setPadding(new Insets(10));

Another place you can reuse code is where a checkbox and an uneditable text field appear together( in a horizontal box).

You should consider using a GridPane to organize the horizontal boxes that contain the checkbox- text field pairs.

Due Date

Friday at the end of week 4.