Patel Arth Lab7
Patel Arth Lab7
##Methodology:
First I setup GUI components that includes ComboBox, RadioButtons and Button.
The 'lunchcomboBox' is intializes with lunch items and creates radiobuttons for
drinks. and grouped them using ToggleGroup. Next, I arranged Borderpane layout
with combobox at top, Textarea in the centre and buttons on bottom. Provides
Calculation method for total cost. For display the result create a textarea. At last,
apply main method.
#code:
package application;
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.HBox;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
@Override
public void start(Stage primaryStage)
{
primaryStage.setTitle("Menu For Lunch");
primaryStage.setScene(scene);
primaryStage.show();
}
if (selectedLunchItem != null)
{
if (selectedLunchItem.equals("Hot Dog"))
{
lunchPrice = 3.57;
}
else if (selectedLunchItem.equals("Sandwich"))
{
lunchPrice = 6.0;
}
else if (selectedLunchItem.equals("Hamburger"))
{
lunchPrice = 5.5;
}
}