Answered step by step
Verified Expert Solution
Question
1 Approved Answer
i need help coding this in java: A university has the following dormitories: Allen Hall: $ 1 , 8 0 0 per semester Pike Hall:
i need help coding this in java: A university has the following dormitories: Allen Hall: $ per semester Pike Hall: $ per semester Farthing Hall: $ per semester University Suites: $ per semester The university also offers the following meal plans: meals per week: $ per semester meals per week: $ per semester Unlimited meals: $ per semester Create an application with two ComboBox controls. One should hold the names of the dormitories, and the other should hold the meal plans. The user should select a dormitory and a meal plan, and the application should show the total charges for the semester. this is in main.java import javafx.application.Application; import javafx.stage.Stage; import javafx.scene.Scene; import javafx.scene.layout.VBox; import javafx.scene.layout.HBox; import javafx.geometry.Pos; import javafx.geometry.Insets; import javafx.scene.control.Label; import javafx.scene.control.Button; import javafx.scene.control.ComboBox; Dorm and Meal Plan Calculator public class DormAndMealPlan extends Application public static void mainString args Launch the application. launchargs; @Override public void startStage primaryStage Build the Dorm ComboBox. Label to prompt the user to select a dorm Build the Meal Plan ComboBox. Label to prompt the user to select a meal plan Create the output label for total cost. Create the Calculate button. Register event handler for the button calcButton.setOnActionevent double dormCharges ; double mealCharges ; double totalCharges ; if dormComboBoxgetValue null String dorm dormComboBox.getValue; if dormequalsAllen Hall" dormCharges ; else if dormequalsPike Hall" dormCharges ; else if dormequalsFarthing Hall" dormCharges ; else if dormequalsUniversity Suites" dormCharges ; else dormCharges ; if mealComboBoxgetValue null code for mealComboBox Get the total charges totalCharges dormCharges mealCharges; Display the charges. costOutputLabelsetTextStringformatf totalCharges; ; Put everything into a VBox VBox mainVBox new VBox dormAndMealHBox, costHBox calcButton; mainVBox.setAlignmentPosCENTER; mainVBox.setPaddingnew Insets; Add the main VBox to a scene. Scene scene new ScenemainVBox; Set the scene to the stage aand display it primaryStage.setScenescene; primaryStage.show; this is in problem.txt: show output as well, please.
i need help coding this in java:
A university has the following dormitories:
Allen Hall: $ per semester
Pike Hall: $ per semester
Farthing Hall: $ per semester
University Suites: $ per semester
The university also offers the following meal plans:
meals per week: $ per semester
meals per week: $ per semester
Unlimited meals: $ per semester
Create an application with two ComboBox controls. One should hold the names of the dormitories, and the other should hold the meal plans. The user should select a dormitory and a meal plan, and the application should show the total charges for the semester.
this is in main.java
import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.VBox;
import javafx.scene.layout.HBox;
import javafx.geometry.Pos;
import javafx.geometry.Insets;
import javafx.scene.control.Label;
import javafx.scene.control.Button;
import javafx.scene.control.ComboBox;
Dorm and Meal Plan Calculator
public class DormAndMealPlan extends Application
public static void mainString args
Launch the application.
launchargs;
@Override
public void startStage primaryStage
Build the Dorm ComboBox.
Label to prompt the user to select a dorm
Build the Meal Plan ComboBox.
Label to prompt the user to select a meal plan
Create the output label for total cost.
Create the Calculate button.
Register event handler for the button
calcButton.setOnActionevent
double dormCharges ;
double mealCharges ;
double totalCharges ;
if dormComboBoxgetValue null
String dorm dormComboBox.getValue;
if dormequalsAllen Hall"
dormCharges ;
else if dormequalsPike Hall"
dormCharges ;
else if dormequalsFarthing Hall"
dormCharges ;
else if dormequalsUniversity Suites"
dormCharges ;
else
dormCharges ;
if mealComboBoxgetValue null
code for mealComboBox
Get the total charges
totalCharges dormCharges mealCharges;
Display the charges.
costOutputLabelsetTextStringformatf totalCharges;
;
Put everything into a VBox
VBox mainVBox new VBox dormAndMealHBox, costHBox calcButton;
mainVBox.setAlignmentPosCENTER;
mainVBox.setPaddingnew Insets;
Add the main VBox to a scene.
Scene scene new ScenemainVBox;
Set the scene to the stage aand display it
primaryStage.setScenescene;
primaryStage.show;
this is in problem.txt:
show output as well, please.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started