Question: Write a JavaFX application that converts from pounds tokilograms or kilograms to pounds. Include a pair of radiobuttons to indicate the direction of the conversion,
Write a JavaFX application that converts from pounds tokilograms or kilograms to pounds. Include a pair of radiobuttons to indicate the direction of the conversion, and a pair oftext fields (with appropriate labels) to allow input of thenumbers. Also include a "Convert" button, a "Clear" button, and aempty label where error messages can be displayed if necessary.
By default, the "Pounds to Kilograms" radio button should beselected. Whichever radio button is selected, the other textfield should be set as not editable. For example when the"Pounds to Kilograms" radio button is selected, the kilograms textfield should be uneditable. Also, whenever either radiobutton is clicked, both text fields and the error label should becleared of text.
Of course, the user's input is received as text and must beparsed to a double. If the user's input cannot be beconverted (because it is non-numeric), an exception will be thrownwhen the input is parsed. Catch the exception and output anappropriate error message in the label at the bottom of thescene.
Helpful hint:The controls can be laid out inrows by using HBoxes, although a GridPane will work better for theTextFields and their associated labels. The verticalalignment can achieved by placing the HBoxes and GridPane in anouter VBox.
Conversion Factor: 1 pound = 0.4535924kilograms

Weight Converter Pounds to Kilograms Pounds 12 Kilograms 5.443 kilograms Convert Clear Weight Converter Pounds to Kilograms Pounds Three Kilograms Convert Clear Invalid Input Kilograms to pounds Kilograms to pounds X Weight Converter Pounds to Kilograms Pounds 26.455 pounds Kilograms 12 Convert Clear Kilograms to pounds
Step by Step Solution
There are 3 Steps involved in it
import javafxapplicationApplication import javafxgeometryInsets import javafxgeometryPos import javafxsceneScene import javafxscenecontrolButton impor... View full answer
Get step-by-step solutions from verified subject matter experts
